今天是我学习iOS的第一天。正在看iOS开发指南的书。
边看边做,出现一个错误。
错误日志以及解决方法如下:
2014-12-18 20:14:57.763 Label_ButtonSample_3.2.1[5770:493343] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[
*** First throw call stack:
(
0 CoreFoundation 0x000000010b7bdf35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010b456bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010b7bdb79 -[NSException raise] + 9
3 Foundation 0x000000010aff37b3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010b707e80 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010be6fc7d -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010bccef98 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010bccf588 -[UIViewController loadView] + 109
8 UIKit 0x000000010bccf7f9 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010bccfc8e -[UIViewController view] + 27
10 UIKit 0x000000010bbeeca9 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x000000010bbef041 -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x000000010bbfb72c -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x000000010bba6061 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628
14 UIKit 0x000000010bba8d2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
15 UIKit 0x000000010bba7bf2 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x000000010e3792a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
17 CoreFoundation 0x000000010b6f353c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010b6e9285 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010b6e9045 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010b6e8486 CFRunLoopRunSpecific + 470
21 UIKit 0x000000010bba7669 -[UIApplication _run] + 413
22 UIKit 0x000000010bbaa420 UIApplicationMain + 1282
23 Label_ButtonSample_3.2.1 0x000000010af2abf3 main + 115
24 libdyld.dylib 0x000000010dd4d145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
这个错误是因为我用control按住并且拖拽Button到代码后,我又把代码给删除了,就会出现这个错误。
解决方法是在故事版中的事件绑定里面把刚在在代码上删除的部分在这也删除。
也就是说删除代码的同时也要删除故事版试图的事件绑定关系。