iOS5和XCode4错误-由于未捕获的异常终止应用程序';NSUnknownKeyException';

iOS5和XCode4错误-由于未捕获的异常终止应用程序';NSUnknownKeyException';,ios5,ios4,Ios5,Ios4,我最近更新了Xcode以使用iOS5 SDK。因为更新我的应用程序会在启动屏幕上崩溃。此前,该应用程序同时在4.3和iPhone上运行(iOS5之前)。 错误指向:int retVal=UIApplicationMain(argc,argv,nil,nil) 大体上 控制台返回以下内容: GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45 UTC 2011) Copyright 2004 Free Softw

我最近更新了Xcode以使用iOS5 SDK。因为更新我的应用程序会在启动屏幕上崩溃。此前,该应用程序同时在4.3和iPhone上运行(iOS5之前)。 错误指向:
int retVal=UIApplicationMain(argc,argv,nil,nil)
大体上

控制台返回以下内容:

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug  8 20:32:45 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".Attaching to process 3903.
2011-11-13 22:11:05.421 BlastCalc[3903:10d03] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x5c1b600> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key averageChargeLengthLabel.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00e7b5a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00fcf313 objc_exception_throw + 44
    2   CoreFoundation                      0x00e7b4e1 -[NSException raise] + 17
    3   Foundation                          0x0084d677 _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x0084d5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x002c930c -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x00df18cf -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x002c7d23 -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x002c9ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x000cf17a -[UIApplication _loadMainNibFile] + 172
    10  UIKit                               0x000cfcf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
    11  UIKit                               0x000da617 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x000d2abf -[UIApplication sendEvent:] + 71
    13  UIKit                               0x000d7f2e _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x0132f992 PurpleEventCallback + 1550
    15  CoreFoundation                      0x00e5c944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x00dbccf7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x00db9f83 __CFRunLoopRun + 979
    18  CoreFoundation                      0x00db9840 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x00db9761 CFRunLoopRunInMode + 97
    20  UIKit                               0x000cf7d2 -[UIApplication _run] + 623
    21  UIKit                               0x000dbc93 UIApplicationMain + 1160
    22  BlastCalc                           0x00002979 main + 121
    23  BlastCalc                           0x000028f5 start + 53
    24  ???                                 0x00000001 0x0 + 1
)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
(gdb)
GNU gdb 6.3.50-20050815(苹果版gdb-1708)(2011年8月8日星期一20:32:45 UTC)
版权所有2004免费软件基金会。
GDB是自由软件,受GNU通用公共许可证的保护,您是
欢迎在特定条件下更改和/或分发副本。
键入“显示复制”以查看条件。
GDB绝对没有保修。有关详细信息,请键入“显示保修”。
此GDB配置为“x86_64-apple-darwin”。连接到进程3903。
2011-11-13 22:11:05.421 BlastCalc[3903:10d03]***由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[setValue:forUndefinedKey::]:此类不符合key Average ChargeLengthLabel的键值编码。”
***第一次抛出时调用堆栈:
(
0 CoreFoundation 0x00e7b5a9例外预处理+185
1 libobjc.A.dylib 0x00fcf313 objc_异常_抛出+44
2芯基础0x00e7b4e1-[N异常升高]+17
3基金会0x084D67 7NSSETUSEKIKESENETSETER + 135
4基金会0x084D5E5- [ NSObjices(NSKEY ValueCoDIN)SETValue:FordK::] + 285
5 UIKit 0x002c930c-[UIRuntimeOutletConnection connect]+112
6 CoreFoundation 0x00df18cf-[NSArray makeObjectsPerformSelector:+239
7 UIKit 0x002c7d23-[UINib实例化所有者:选项:][1041
8 UIKit 0x002c9ab7-[NSBundle(UINSBUNDLEADTIONS)LOADNIBNAME:owner:options:+168
9 UIKit 0x000cf17a-[UIApplication\u loadMainNibFile]+172
10 UIKit 0x000CFCFF4-[UIApplication\u运行时URL:payload:launchOrientation:statusBarStyle:statusBarHidden:+291
11 UIKit 0x000da617-[UIApplication handleEvent:withNewEvent:][1533
12 UIKit 0x000d2abf-[UIApplication sendEvent:+71
13 UIKit 0x000d7f2e _UIApplicationHandleEvent+7576
14图形服务0x0132f992 PurpleEventCallback+1550
15 CoreFoundation 0x00e5c944\uuuu CFRUNLOOP\u正在调用\uu OUT\u以执行\uu函数\uuu52
16 CoreFoundation 0x00dbccf7\uuu CFRunLoopDoSource1+215
17 CoreFoundation 0x00db9f83 _ucfrunlooprun+979
18 CoreFoundation 0x00db9840 CFRunLoopRunSpecific+208
19 CoreFoundation 0x00db9761 CFRUNLOOPSRUNINMODE+97
20 UIKit 0x000cf7d2-[UIU应用程序运行]+623
21 UIKit 0x000dbc93 UIApplicationMain+1160
22 BlastCalc 0x00002979主管道+121
23 BlastCalc 0x000028f5启动+53
24°?0x00000001 0x0+1
)
终止调用引发exceptionsharedlibrary应用加载规则所有
(gdb)
我已经在旧的Xcode版本和SDK中阅读了很多与此相关的修复程序,但是,我还没有找到解决我的问题的修复程序。我对iOS不是很精通,改成5让我很困惑

如果有人能告诉我答案,我将不胜感激。提前谢谢大家


目前,我正在把我的应用程序杀掉,几乎决定从一开始就可以重新编码。我尝试过一次,但是整个故事板的事情让它变得很困难

我遇到了同样的问题。我终于做到了:

  • 对于
    averageChargeLength
    标签,请使用Xcode接口生成器 (通过选择故事板或xib)并打开 连接面板。有了故事板,你可以控制点击 打开它以打开“连接”面板
  • 删除所有出口 将鼠标悬停在连接上并单击 微小的
    x
  • 尝试在模拟器中再次运行应用程序。对我来说,那 允许我的应用毫无例外地运行,但标签没有 更新了
  • 如果可行,那么返回Xcode接口生成器并 尝试通过拖动 连接回
    ViewController.h
    文件。一定要检查 连接中重复代码的等效.m文件 插入并移除它
  • 再次尝试运行你的应用程序。而对我来说 由于像以前一样失败,它实际上运行了

  • 我以前失败的原因是我试图将一个按钮连接到错误的东西上。我删除了它所连接的东西,但从未检查界面生成器以确保连接也已断开。

    我只是遇到了同样的问题。我终于做到了:

  • 对于
    averageChargeLength
    标签,请使用Xcode接口生成器 (通过选择故事板或xib)并打开 连接面板。有了故事板,你可以控制点击 打开它以打开“连接”面板
  • 删除所有出口 将鼠标悬停在连接上并单击 微小的
    x
  • 尝试在模拟器中再次运行应用程序。对我来说,那 允许我的应用毫无例外地运行,但标签没有 更新了
  • 如果可行,那么返回Xcode接口生成器并 尝试