UI故事版创建简单应用

iOS 码拜 9年前 (2015-05-03) 1233次浏览 0个评论

2015-04-17 16:50:44.836 Excise[2874:60b] *** Terminating app due to uncaught exception “”NSUnknownKeyException””, reason: “”[<LZViewController 0x8d3eba0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key The.””
*** First throw call stack:
(
0   CoreFoundation                      0x018001e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x0156b8e5 objc_exception_throw + 44
2   CoreFoundation                      0x0188ffe1 -[NSException raise] + 17
3   Foundation                          0x0122bd9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4   Foundation                          0x011981d7 _NSSetUsingKeyValueSetter + 88
5   Foundation                          0x01197731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6   Foundation                          0x011f9b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7   UIKit                               0x004e21f4 -[UIRuntimeOutletConnection connect] + 106
8   libobjc.A.dylib                     0x0157d7de -[NSObject performSelector:] + 62
9   CoreFoundation                      0x017fb76a -[NSArray makeObjectsPerformSelector:] + 314
10  UIKit                               0x004e0d4d -[UINib instantiateWithOwner:options:] + 1417
11  UIKit                               0x003496f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12  UIKit                               0x00349e9d -[UIViewController loadView] + 302
13  UIKit                               0x0034a0d3 -[UIViewController loadViewIfRequired] + 78
14  UIKit                               0x0034a5d9 -[UIViewController view] + 35
15  UIKit                               0x0026a267 -[UIWindow addRootViewControllerViewIfPossible] + 66
16  UIKit                               0x0026a5ef -[UIWindow _setHidden:forced:] + 312
17  UIKit                               0x0026a86b -[UIWindow _orderFrontWithoutMakingKey] + 49
18  UIKit                               0x002753c8 -[UIWindow makeKeyAndVisible] + 65
19  UIKit                               0x00225bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
20  UIKit                               0x0022a667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
21  UIKit                               0x0023ef92 -[UIApplication handleEvent:withNewEvent:] + 3517
22  UIKit                               0x0023f555 -[UIApplication sendEvent:] + 85
23  UIKit                               0x0022c250 _UIApplicationHandleEvent + 683
24  GraphicsServices                    0x037e1f02 _PurpleEventCallback + 776
25  GraphicsServices                    0x037e1a0d PurpleEventCallback + 46
26  CoreFoundation                      0x0177bca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
27  CoreFoundation                      0x0177b9db __CFRunLoopDoSource1 + 523
28  CoreFoundation                      0x017a668c __CFRunLoopRun + 2156
29  CoreFoundation                      0x017a59d3 CFRunLoopRunSpecific + 467
30  CoreFoundation                      0x017a57eb CFRunLoopRunInMode + 123
31  UIKit                               0x00229d9c -[UIApplication _run] + 840
32  UIKit                               0x0022bf9b UIApplicationMain + 1225
33  Excise                              0x00002d6d main + 141
34  libdyld.dylib                       0x01e33701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我利用故事板添加了文本框和按钮,但是执行时遇到了如上的问题,不知道该怎么办了,求大神指导啊,应该不是网上说的按钮冒号丢失的问题,因为我把按钮触发事件那行代码注销之后还是会有同样的错误,希望大神们能帮我解决一下,小弟不胜感激。急!!

UI故事版创建简单应用
25分
IBOutlet 连错了,你是不是删除过某一个属性?可以确实问题是在Storyboard 的LZViewController上
UI故事版创建简单应用
你在LZViewController上右键,看看有没有警告之类的,Clean 下工程和 Clean Build Folder 也可以试试。
UI故事版创建简单应用
怎么clean工程?(弱弱的问一下)
UI故事版创建简单应用
引用 3 楼 Never_give_upLZ 的回复:

怎么clean工程?(弱弱的问一下)

在Xcode里菜单栏上,Product => Clean,这就是 clean 工程,按住 option 键,就是 Clean Build Folder

UI故事版创建简单应用
25分
这种问题,一般是xib or storyboard在与对应class上的IBOutlet 插座变量连接时,如果已经建立连接关系,而在指定的viewcontroller中却将这个变量删除或改了其它名称,这样在通过xib or storyboard在初始化时就会导致如你上面一样的错误。
检查storyboard 与指定的类中插座变量的连接是否正确。删除不正确的连接,接着再重新建立连接。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明UI故事版创建简单应用
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!