【发布时间】:2012-11-06 22:44:14
【问题描述】:
在第一次编译后,Xcode 从线程 1 发出一个关于 SIGABRT 的错误。错误日志显示了这个,
2012-11-18 20:26:37.866 Test app[26222:8a03] Unknown class 'AppDelegate', using 'NSObject' instead. Encountered in Interface Builder file at path /Users/tommiller/Library/Developer/Xcode/DerivedData/Test_app-gvobsrwxsylgvkamecrxetkkkorf/Build/Products/Debug/Test app.app/Contents/Resources/en.lproj/MainMenu.nib.
2012-11-18 20:26:37.908 Test app[26222:8a03] -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance 0x7fcfb8659660
2012-11-18 20:26:37.909 Test app[26222:8a03] An uncaught exception was raised
2012-11-18 20:26:37.909 Test app[26222:8a03] -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance 0x7fcfb8659660
2012-11-18 20:26:37.913 Test app[26222:8a03] (
0 CoreFoundation 0x000000010e42dfc6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x000000010e29bd5e objc_exception_throw + 43
2 CoreFoundation 0x000000010e4ba2ae -[NSObject doesNotRecognizeSelector:] + 190
3 CoreFoundation 0x000000010e41ae73 ___forwarding___ + 371
4 CoreFoundation 0x000000010e41ac88 _CF_forwarding_prep_0 + 232
5 AppKit 0x000000010eef3178 -[NSCell _setContents:] + 73
6 AppKit 0x000000010eef3055 -[NSCell setObjectValue:] + 160
7 AppKit 0x000000010f115adc -[_NSPlaceholderTextFieldPlugin showValue:inObject:] + 388
8 AppKit 0x000000010f0fdf31 -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] + 809
9 AppKit 0x000000010f0fdb74 -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 303
10 AppKit 0x000000010f1158cf -[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] + 43
11 AppKit 0x000000010eeec777 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
12 AppKit 0x000000010eee5a89 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
13 AppKit 0x000000010eedc09f loadNib + 322
14 AppKit 0x000000010eedb59c +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
15 AppKit 0x000000010eedb4b7 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
16 AppKit 0x000000010eedb3fa +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
17 AppKit 0x000000010f14e9b3 NSApplicationMain + 398
18 Test app 0x000000010e22de12 main + 34
19 Test app 0x000000010e22dde4 start + 52
)
2012-11-18 20:26:37.972 Test app[26222:8a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance 0x7fcfb8659660'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e42dfc6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x000000010e29bd5e objc_exception_throw + 43
2 CoreFoundation 0x000000010e4ba2ae -[NSObject doesNotRecognizeSelector:] + 190
3 CoreFoundation 0x000000010e41ae73 ___forwarding___ + 371
4 CoreFoundation 0x000000010e41ac88 _CF_forwarding_prep_0 + 232
5 AppKit 0x000000010eef3178 -[NSCell _setContents:] + 73
6 AppKit 0x000000010eef3055 -[NSCell setObjectValue:] + 160
7 AppKit 0x000000010f115adc -[_NSPlaceholderTextFieldPlugin showValue:inObject:] + 388
8 AppKit 0x000000010f0fdf31 -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] + 809
9 AppKit 0x000000010f0fdb74 -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 303
10 AppKit 0x000000010f1158cf -[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] + 43
11 AppKit 0x000000010eeec777 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
12 AppKit 0x000000010eee5a89 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
13 AppKit 0x000000010eedc09f loadNib + 322
14 AppKit 0x000000010eedb59c +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
15 AppKit 0x000000010eedb4b7 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
16 AppKit 0x000000010eedb3fa +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
17 AppKit 0x000000010f14e9b3 NSApplicationMain + 398
18 Test app 0x000000010e22de12 main + 34
19 Test app 0x000000010e22dde4 start + 52
)
terminate called throwing an exception(lldb)
信号来自 main.m 内的return NSApplicationMain(argc, (const char **)argv);,
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}
我很少收到这些记录的错误,所以我不知道错误指向什么。我最好的猜测是 14 AppKit 0x000000010eedb59c +[NSBundle(NSNibLoading)_loadNibFile:nameTable:withZone:ownerBundle:] + 217 没有加载 XIB?... 我该如何解决这个问题?
【问题讨论】:
-
一些调试建议:在 Objective-C 异常上设置断点并在您用于运行它的方案中启用僵尸。这些步骤可能会提供更好的错误消息。我认为您对 xib 文件的一些奇怪之处是正确的,但尚不清楚是什么(可能是绑定到文本字段?)。
-
我在 main.m 的错误点上做了一个断点,得到了这个,0x109deade4: movl %eax, %edi
标签: xcode macos osx-lion osx-snow-leopard sigabrt