XIB未删除连线

016-02-24 18:00:29.200 LoginAndRegister[6955:277483] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7f872b636570> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-24 18:00:29.200 LoginAndRegister[6955:277483] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7f872b636570> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-24 18:00:29.204 LoginAndRegister[6955:277483] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<ViewController 0x7f872b629910> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key HeadImageView.’
*** First throw call stack:
(
0 CoreFoundation 0x0000000108d15f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000108404deb objc_exception_throw + 48
2 CoreFoundation 0x0000000108d15b89 -[NSException raise] + 9
3 Foundation 0x0000000107fd0a6b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x000000010924e04c -[UIViewController setValue:forKey:] + 88
5 UIKit 0x000000010947ba71 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000108c56a80 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x000000010947a454 -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x0000000109254c16 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x0000000109255542 -[UIViewController loadView] + 178
10 UIKit 0x00000001092558a0 -[UIViewController loadViewIfRequired] + 138
11 UIKit 0x0000000109256013 -[UIViewController view] + 27
12 UIKit 0x000000010912f51c -[UIWindow addRootViewControllerViewIfPossible] + 61
13 UIKit 0x000000010913038b -[UIWindow setRootViewController:] + 1144
14 LoginAndRegister 0x0000000107f02b4d -[AppDelegate application:didFinishLaunchingWithOptions:] + 621
15 UIKit 0x00000001090b9f24 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
16 UIKit 0x00000001090bb0ca -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
17 UIKit 0x00000001090c19c3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750
18 UIKit 0x00000001090beba3 -[UIApplication workspaceDidEndTransaction:] + 188
19 FrontBoardServices 0x000000010bac1784 -[FBSSerialQueue _performNext] + 192
20 FrontBoardServices 0x000000010bac1af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x0000000108c42011 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
22 CoreFoundation 0x0000000108c37f3c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x0000000108c373f3 __CFRunLoopRun + 867
24 CoreFoundation 0x0000000108c36e08 CFRunLoopRunSpecific + 488
25 UIKit 0x00000001090be4f5 -[UIApplication _run] + 402
26 UIKit 0x00000001090c330d UIApplicationMain + 171
27 LoginAndRegister 0x0000000107f036ef main + 111
28 libdyld.dylib 0x000000010b45192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

要检查这一问题,可以从两个方面入手。
第一种出错的原因可能是错误的IBOutlet连接,即xib中定义了某个IBOutlet,但是在对应的头文件中,该IBOutlet已经被修改或删除。要检查这一问题,可以打开xib文件,在File’s Owner上点击右键,然后在弹出的窗口中检查是否有“惊叹号”提示的IBOutlet连接,基本上可以找到问题所在。
第二种出错的原因可能是在xib文件中没有正确指定对象的类。要检查这一问题,可以打开xib文件,查看自定义视图控制器或者视图的Custom Class是否定义正确即可。

    原文作者:胖渣大橘子
    原文地址: https://www.jianshu.com/p/7c3fc079b0f8
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞