简体   繁体   English

iPhone应用程序在启动时崩溃

[英]iPhone app crashes on startup

I had two apps in xcode, which i wanted to combine, so i started a new project and attempted to put the two apps together in this new one. 我想将xcode中的两个应用程序合并在一起,因此我开始了一个新项目,并试图将这两个应用程序合并到一个新项目中。 Was this a really stupid thing to do? 这是真的很愚蠢的事情吗?

The app now crashes on start up and i have no idea why, i'm 99% the outlets are all connected. 该应用程序现在在启动时崩溃,我不知道为什么,我99%的插座都已连接。 It uses xcdatamodel for storage and i've imported the right framework. 它使用xcdatamodel进行存储,并且我已经导入了正确的框架。

Can anyone think of any other things that could be going wrong? 谁能想到其他可能出错的事情?

I can attach a zip file with the project in if someone wouldn't mind having a look 如果有人不介意我可以在项目中附加一个zip文件

Any help is massively appreciated! 任何帮助深表感谢!

Thanks 谢谢

This is the stack trace: 这是堆栈跟踪:

    2010-11-02 08:18:59.903 iStalker[34745:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x5b10e20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textField.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x0256f919 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x026bd5de objc_exception_throw + 47
    2   CoreFoundation                      0x0256f851 -[NSException raise] + 17
    3   Foundation                          0x0003bc2b _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x0003bb99 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x004b5d0a -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x024e5b6f -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x004b4721 -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x004b64b5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x002c59bb -[UIApplication _loadMainNibFile] + 172
    10  UIKit                               0x002c690d -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 198
    11  UIKit                               0x002d0452 -[UIApplication handleEvent:withNewEvent:] + 1958
    12  UIKit                               0x002c9074 -[UIApplication sendEvent:] + 71
    13  UIKit                               0x002cdac4 _UIApplicationHandleEvent + 7495
    14  GraphicsServices                    0x02dd5afa PurpleEventCallback + 1578
    15  CoreFoundation                      0x02550dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x024b1737 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x024ae9c3 __CFRunLoopRun + 979
    18  CoreFoundation                      0x024ae280 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x024ae1a1 CFRunLoopRunInMode + 97
    20  UIKit                               0x002c6226 -[UIApplication _run] + 625
    21  UIKit                               0x002d1b58 UIApplicationMain + 1160
    22  iStalker                            0x00001b50 main + 102
    23  iStalker                            0x00001ae1 start + 53
)
terminate called after throwing an instance of 'NSException'

Looks like you have a text field connected to the application delegate in your main XIB. 看起来您的主XIB中有一个文本字段连接到应用程序委托。 There is no such field defined on the real application delegate, which is why you're getting the error. 在实际的应用程序委托上没有定义此类字段,这就是为什么您会收到错误的原因。

Thats because you set main xib for app in info plist and set File Owner to appDelegate , while main xib file's owner is always UIApplication . 那是因为你设置的主要xib在信息的plist应用程序,并设置文件所有者来appDelegate ,而主要的xib文件的所有者总是UIApplication Possible solution - add Object to .xib , set its class for a ppDelegate class and connect all unnecessary outlets. 可能的解决方案-将Object添加到.xib ,将其类设置为ppDelegate类并连接所有不必要的出口。 This worked for me. 这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM