iOS 模拟器在应用程序执行时是黑色的

标签 ios xcode5 nsunknownkeyexception

我正在运行 xcode 5.1.1 并且一直在尝试学习 objective C/iOS 开发。现在,每当我尝试在模拟器上运行我的代码时(我没有实际的设备 atm),它都会出现黑屏。可以查到代码here .编译运行报如下错误:

2014-08-23 10:42:57.429 Calculator[1862:60b] *** Terminating app due to uncaught exception         'NSUnknownKeyException', reason: '[<XYZViewController 0xe436640> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key didgetPressed.'
*** First throw call stack:
(
0   CoreFoundation                      0x017ed1e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x0156c8e5 objc_exception_throw + 44
2   CoreFoundation                      0x0187cfe1 -[NSException raise] + 17
3   Foundation                          0x0122cd9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4   Foundation                          0x011991d7 _NSSetUsingKeyValueSetter + 88
5   Foundation                          0x01198731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6   Foundation                          0x011fab0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7   UIKit                               0x004e31f4 -[UIRuntimeOutletConnection connect] + 106
8   libobjc.A.dylib                     0x0157e7de -[NSObject performSelector:] + 62
9   CoreFoundation                      0x017e876a -[NSArray makeObjectsPerformSelector:] + 314
10  UIKit                               0x004e1d4d -[UINib instantiateWithOwner:options:] + 1417
11  UIKit                               0x0034a6f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12  UIKit                               0x0034ae9d -[UIViewController loadView] + 302
13  UIKit                               0x0034b0d3 -[UIViewController loadViewIfRequired] + 78
14  UIKit                               0x0034b5d9 -[UIViewController view] + 35
15  UIKit                               0x0026b267 -[UIWindow addRootViewControllerViewIfPossible] + 66
16  UIKit                               0x0026b5ef -[UIWindow _setHidden:forced:] + 312
17  UIKit                               0x0026b86b -[UIWindow _orderFrontWithoutMakingKey] + 49
18  UIKit                               0x002763c8 -[UIWindow makeKeyAndVisible] + 65
19  UIKit                               0x00226bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
20  UIKit                               0x0022b667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
21  UIKit                               0x0023ff92 -[UIApplication handleEvent:withNewEvent:] + 3517
22  UIKit                               0x00240555 -[UIApplication sendEvent:] + 85
23  UIKit                               0x0022d250 _UIApplicationHandleEvent + 683
24  GraphicsServices                    0x037e2f02 _PurpleEventCallback + 776
25  GraphicsServices                    0x037e2a0d PurpleEventCallback + 46
26  CoreFoundation                      0x01768ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
27  CoreFoundation                      0x017689db __CFRunLoopDoSource1 + 523
28  CoreFoundation                      0x0179368c __CFRunLoopRun + 2156
29  CoreFoundation                      0x017929d3 CFRunLoopRunSpecific + 467
30  CoreFoundation                      0x017927eb CFRunLoopRunInMode + 123
31  UIKit                               0x0022ad9c -[UIApplication _run] + 840
32  UIKit                               0x0022cf9b UIApplicationMain + 1225
33  Calculator                          0x00002c8d main + 141
34  libdyld.dylib                       0x01e34701 start + 1
35  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

我已经尝试了以下的事情,但到目前为止没有任何效果

1) 查看部署信息,主界面设置为main

2) 仔细检查所有断点以将其关闭并通过调试->禁用断点禁用所有断点

3) 在 iOS 模拟器上重置内容和设置。

4) 检查了 LLDB 调试器的问题,但据我所知,5.1.1 xcode 中不再存在该问题。

5) 检查本地主机仍然设置为 127.0.0.1

谢谢! - 特林

最佳答案

我检查了你的项目。数字 (didgetPressed:) 的 IBActions 已正确连接,但 IBOutlets 未正确连接(属性 didgetPressed 不存在)。

当您删除 Storyboard 中的引用 socket 时,它将起作用(见图)。

enter image description here

关于iOS 模拟器在应用程序执行时是黑色的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25463778/

相关文章:

iphone - 如何绘制具有大y轴的coreplot条形图?

ios - 我如何替换 iOS7 的手机间隙聚光灯图标?

macos - Xcode 在所有项目文件中查找并替换

ios - 未捕获的异常 : This class is not key value coding-compliant

ios - Health Kit 中的 HKObserverQuery

ios - Xcode 4.6 自动授权不工作 - "no valid aps-environment"

iphone - 这个pushViewController语句在我正在做的教程中如何工作?

ios - 非续订订阅是否需要还原按钮?

ios - CustomCell 为空或导致 SIGABRT 错误 [W/代码]