macos – 狮子会的EXC_BAD_INSTRUCTION,而不是Mountain Lion

macos – 狮子会的EXC_BAD_INSTRUCTION,而不是Mountain Lion,第1张

概述我在Lion中打开一个窗口时收到以下EXC_BAD_INSTRUCTION异常但该应用似乎在Mountain Lion中正常工作.可能是什么问题? Process:         MyApp [595]Path:            /Users/USER/Desktop/MyApp.app/Contents/MacOS/MyAppIdentifier:      com.example. 我在lion中打开一个窗口时收到以下EXC_BAD_INSTRUCTION异常但该应用似乎在Mountain lion中正常工作.可能是什么问题?

Process:         MyApp [595]Path:            /Users/USER/Desktop/MyApp.app/Contents/MacOS/MyAppIDentifIEr:      com.example.MyAppVersion:         ??? (0.4)Code Type:       X86-64 (Native)Parent Process:  launchd [146]Date/Time:       2012-09-25 11:09:14.498 +0200OS Version:      Mac OS X 10.7.3 (11D50d)Report Version:  9Sleep/Wake UUID: BA4DA964-60E8-4DC6-B63C-99435074A41CInterval Since Last Report:          2901634 secCrashes Since Last Report:           367Per-App Interval Since Last Report:  129923 secPer-App Crashes Since Last Report:   8Anonymous UUID:                      BFF6E121-730D-4729-B07F-DA8550F46E14Crashed Thread:  0  dispatch queue: com.apple.main-threadException Type:  EXC_BAD_INSTRUCTION (SIGILL)Exception Codes: 0x0000000000000001,0x0000000000000000Application Specific information:objc[595]: garbage collection is OFFobjc[595]: cannot form weak reference to instance (0x7fc091666650) of class MyVIEwControllerPerforming @selector(startpressed:) from sender NSbutton 0x7fc09167d210Thread 0 Crashed:: dispatch queue: com.apple.main-thread0   libobjc.A.dylib                0x00007fff91496768 _objc_trap + 41   libobjc.A.dylib                0x00007fff914968aa _objc_fatal + 1952   libobjc.A.dylib                0x00007fff914a24ad weak_register_no_lock + 3463   libobjc.A.dylib                0x00007fff914a2a59 objc_storeWeak + 3604   com.apple.CoreFoundation       0x00007fff8f29c75d -[NSObject performSelector:withObject:] + 615   com.apple.AppKit               0x00007fff94bb5392 -[NSNibOutletConnector establishConnection] + 4056   com.apple.AppKit               0x00007fff94bb2a89 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 107
解决方法 找到了.问题是我已经声明了一个弱的委托ID属性并为其分配了一个NSVIEWcontroller.

显然,如果你想支持lion并且安全,你绝不应该将ID属性声明为弱.从过渡到ARC Release Notes:

Note: In addition,in OS X v10.7,you cannot create weak references to
instances of NSFontManager,NSFontPanel,NSImage,NStableCellVIEw,
NSVIEwController,NSWindow,and NSWindowController. In addition,in OS
X v10.7 no classes in the AV Foundation framework support weak
references.

解决方案:使用assign代替.

@property (nonatomic,assign) IBOutlet ID<MyDelegateProtocol> delegate;
总结

以上是内存溢出为你收集整理的macos – 狮子会的EXC_BAD_INSTRUCTION,而不是Mountain Lion全部内容,希望文章能够帮你解决macos – 狮子会的EXC_BAD_INSTRUCTION,而不是Mountain Lion所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1002837.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存