当我从NIB加载窗口时,我看到了这个错误。 Apple代码中出现错误。我的加载代码都正确执行,当它正在运行时,所有插座都设置正确。
Cannot create BOOL from object <NSWindow: 0x7f883b44f770> of class NSWindow
以下是被称为
的代码- (void)awakeFromNib{
[self showLoginSheet];
}
- (void)showLoginSheet
// User has asked to see the custom display. Display it.
{
if (!self.loginSheet)
[NSBundle loadNibNamed:@"LoginSheet" owner:self];
//Check the myCustomSheet instance variable to make sure the custom sheet does not already exist
[NSApp beginSheet: self.loginSheet
modalForWindow: [[NSApp delegate] window]
modalDelegate: self
didEndSelector: NULL
contextInfo: NULL];
}
堆栈跟踪是
2012-07-21 21:09:57.575 MingleLookBooks[15934:503] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot create BOOL from object <NSWindow: 0x7f883b44f770> of class NSWindow'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff91305f56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff874b9d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff91305d8a +[NSException raise:format:arguments:] + 106
3 AppKit 0x00007fff9038a394 _NSBoolFromValue + 421
4 AppKit 0x00007fff903b1c5a -[NSEditableBinder hiddenState] + 83
5 AppKit 0x00007fff903b1bdf -[NSEditableBinder _hiddenStateWithMode:] + 41
6 AppKit 0x00007fff90389eaa -[NSEditableBinder _setStatesImmediatelyInObject:mode:triggerRedisplay:] + 579
7 AppKit 0x00007fff90389c60 -[NSEditableBinder _observeValueForKeyPath:ofObject:context:] + 123
8 AppKit 0x00007fff901a1643 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
9 AppKit 0x00007fff9019a959 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
10 AppKit 0x00007fff90190f73 loadNib + 322
11 AppKit 0x00007fff90190470 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
12 AppKit 0x00007fff9019038b +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
13 AppKit 0x00007fff901902ce +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
14 MingleLookBooks 0x000000010ef0917a -[AppController showLoginSheet] + 138
15 MingleLookBooks 0x000000010ef08ffb -[AppController awakeFromNib] + 43
16 CoreFoundation 0x00007fff912fcfb1 -[NSObject performSelector:] + 49
17 CoreFoundation 0x00007fff912fcf32 -[NSSet makeObjectsPerformSelector:] + 274
18 AppKit 0x00007fff9019a9ff -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1245
19 AppKit 0x00007fff90190f73 loadNib + 322
20 AppKit 0x00007fff90190470 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
21 AppKit 0x00007fff9019038b +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
22 AppKit 0x00007fff901902ce +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
23 AppKit 0x00007fff9040106f NSApplicationMain + 398
24 MingleLookBooks 0x000000010ef08f32 main + 34
25 MingleLookBooks 0x000000010ef08f04 start + 52
)
terminate called throwing an exception(lldb)
从堆栈跟踪中可以看出,这似乎与我的代码无关。我究竟做错了什么?我没有任何线索,其他类似问题的答案并没有真正帮助。
答案 0 :(得分:2)
看起来您的XIB中的某个绑定设置不正确。