如何在运行项目时修复 xcode AppDelegate 错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31765907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:36:12  来源:igfitidea点击:

how to fix xcode AppDelegate error while running project?

iosxcodeswift

提问by ecatalano

I am a very beginner in iOS development and it's my first project in Xcode 6.4. Although my project is empty (I didn't write any code yet) it's crashing while running on the simulator. Can anybody please help me fixing this issue?

我是 iOS 开发的初学者,这是我在 Xcode 6.4 中的第一个项目。虽然我的项目是空的(我还没有写任何代码)它在模拟器上运行时崩溃了。有人可以帮我解决这个问题吗?

here's a screenshothttp://i.stack.imgur.com/UgCTh.jpg

这是截图http://i.stack.imgur.com/Ug​​CTh.jpg

UPDATE- Error log

更新- 错误日志

2015-08-01 23:20:50.692 ID[3688:177216] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ID.ViewController 0x7867cc40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key doneEditting.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0026e746 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x01c72a97 objc_exception_throw + 44
    2   CoreFoundation                      0x0026e361 -[NSException raise] + 17
    3   Foundation                          0x006f91ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x00656608 _NSSetUsingKeyValueSetter + 115
    5   Foundation                          0x0065658d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   Foundation                          0x0068c016 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 386
    7   UIKit                               0x00ddf622 -[UIRuntimeOutletConnection connect] + 106
    8   libobjc.A.dylib                     0x01c88724 -[NSObject performSelector:] + 62
    9   CoreFoundation                      0x001a647c -[NSArray makeObjectsPerformSelector:] + 316
    10  UIKit                               0x00dde0e3 -[UINib instantiateWithOwner:options:] + 1775
    11  UIKit                               0x00bf80d4 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
    12  UIKit                               0x00bf886b -[UIViewController loadView] + 295
    13  UIKit                               0x00bf8a9f -[UIViewController loadViewIfRequired] + 78
    14  UIKit                               0x00bf9045 -[UIViewController view] + 35
    15  UIKit                               0x00aeae35 -[UIWindow addRootViewControllerViewIfPossible] + 66
    16  UIKit                               0x00aeb2fc -[UIWindow _setHidden:forced:] + 287
    17  UIKit                               0x00aeb5f8 -[UIWindow _orderFrontWithoutMakingKey] + 49
    18  UIKit                               0x00af9966 -[UIWindow makeKeyAndVisible] + 80
    19  UIKit                               0x00a8ee88 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3217
    20  UIKit                               0x00a923d2 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1639
    21  UIKit                               0x00aab8ee __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
    22  UIKit                               0x00a90ffa -[UIApplication workspaceDidEndTransaction:] + 155
    23  FrontBoardServices                  0x0363fc9e __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    24  FrontBoardServices                  0x0363f72f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    25  FrontBoardServices                  0x03651d7c __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 30
    26  CoreFoundation                      0x00190050 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    27  CoreFoundation                      0x00185963 __CFRunLoopDoBlocks + 195
    28  CoreFoundation                      0x001850eb __CFRunLoopRun + 971
    29  CoreFoundation                      0x00184a5b CFRunLoopRunSpecific + 443
    30  CoreFoundation                      0x0018488b CFRunLoopRunInMode + 123
    31  UIKit                               0x00a909b2 -[UIApplication _run] + 571
    32  UIKit                               0x00a940b6 UIApplicationMain + 1526
    33  ID                                  0x0007e4d4 main + 180
    34  libdyld.dylib                       0x0236fac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

回答by Yalamandarao

Might be issue with outlet connection. You may rename the outlet connection name.

可能是插座连接问题。您可以重命名插座连接名称。

Do one thing restart Xcode and clean your Xcode and then run the application simulator or device. I hope it will work.

做一件事重新启动 Xcode 并清理您的 Xcode,然后运行应用程序模拟器或设备。我希望它会起作用。

回答by ecatalano

Ok. Here is the important part of your error to look for in future cases for troubleshooting:

好的。以下是您在未来进行故障排除时要查找的错误的重要部分:

2015-08-01 23:20:50.692 ID[3688:177216] *** Terminating app due to uncaught 
exception 'NSUnknownKeyException', reason: '[<ID.ViewController 0x7867cc40> 
setValue:forUndefinedKey:]: 
this class is not key value coding-compliant for the key doneEditting.'

Check your methods for something named "doneEditting"

检查名为“doneEditting”的方法

My guess is that you accidentally added an extra "t" in the word editing, which is what caused the problem.

我的猜测是您不小心在单词编辑中添加了一个额外的“t”,这就是导致问题的原因。

回答by ecatalano

Well thank you all for your help. I figured out how to solve my problem. I clicked on each and every element on my Main.storyboardand went to the Show the Connections inspectorin the Utilities(right sidebar) and deleted every connection each element on my storyboard had.

嗯,谢谢大家的帮助。我想出了如何解决我的问题。我点击每一个元素在我Main.storyboard去了Show the Connections inspectorUtilities(右侧栏),并删除了所有的连接上我的故事板的每个元素了。