Objective c iPhone中的对象处理错误,在UITabView中选择tab并崩溃

Objective c iPhone中的对象处理错误,在UITabView中选择tab并崩溃,objective-c,xcode,debugging,ios4,tabview,Objective C,Xcode,Debugging,Ios4,Tabview,大家好,我正在创建一个选项卡视图应用程序,在一个选项卡中,我有7个文本字段,我正试图用“保存”按钮保存信息。在我的controller.h文件中的对象和实际文本字段之间建立连接之后,当我选择包含所有这些内容的选项卡时,应用程序崩溃并转到跳板。我在这里调试: 2011-02-23 08:49:02.522 Tow Boat 911[19138:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', re

大家好,我正在创建一个选项卡视图应用程序,在一个选项卡中,我有7个文本字段,我正试图用“保存”按钮保存信息。在我的controller.h文件中的对象和实际文本字段之间建立连接之后,当我选择包含所有这些内容的选项卡时,应用程序崩溃并转到跳板。我在这里调试:

2011-02-23 08:49:02.522 Tow Boat 911[19138:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x4e0d1d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key colour.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00ec6be9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00cbb5c2 objc_exception_throw + 47
    2   CoreFoundation                      0x00ec6b21 -[NSException raise] + 17
    3   Foundation                          0x000286cf _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x0002863d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x004a78d6 -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x00e3d2cf -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x004a62ed -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x004a8081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x00360a94 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
    10  UIKit                               0x0035e709 -[UIViewController loadView] + 120
    11  UIKit                               0x0035e5e3 -[UIViewController view] + 56
    12  UIKit                               0x00371230 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
    13  UIKit                               0x0036fd86 -[UITabBarController transitionFromViewController:toViewController:] + 64
    14  UIKit                               0x00371b7e -[UITabBarController _setSelectedViewController:] + 263
    15  UIKit                               0x003719ed -[UITabBarController _tabBarItemClicked:] + 352
    16  UIKit                               0x002b0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
    17  UIKit                               0x004ae1f2 -[UITabBar _sendAction:withEvent:] + 422
    18  UIKit                               0x002b0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
    19  UIKit                               0x0033f1b5 -[UIControl sendAction:to:forEvent:] + 67
    20  UIKit                               0x00341647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    21  UIKit                               0x0033f16c -[UIControl sendActionsForControlEvents:] + 49
    22  UIKit                               0x002b0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
    23  UIKit                               0x0033f1b5 -[UIControl sendAction:to:forEvent:] + 67
    24  UIKit                               0x00341647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    25  UIKit                               0x003401f4 -[UIControl touchesEnded:withEvent:] + 458
    26  UIKit                               0x002d50d1 -[UIWindow _sendTouchesForEvent:] + 567
    27  UIKit                               0x002b637a -[UIApplication sendEvent:] + 447
    28  UIKit                               0x002bb732 _UIApplicationHandleEvent + 7576
    29  GraphicsServices                    0x016dda36 PurpleEventCallback + 1550
    30  CoreFoundation                      0x00ea8064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    31  CoreFoundation                      0x00e086f7 __CFRunLoopDoSource1 + 215
    32  CoreFoundation                      0x00e05983 __CFRunLoopRun + 979
    33  CoreFoundation                      0x00e05240 CFRunLoopRunSpecific + 208
    34  CoreFoundation                      0x00e05161 CFRunLoopRunInMode + 97
    35  GraphicsServices                    0x016dc268 GSEventRunModal + 217
    36  GraphicsServices                    0x016dc32d GSEventRun + 115
    37  UIKit                               0x002bf42e UIApplicationMain + 1160
    38  Tow Boat 911                        0x00001df8 main + 102
    39  Tow Boat 911                        0x00001d89 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.
2011-02-23 08:49:02.522拖船911[19138:207]***由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[setValue:forUndefinedKey:]:此类不符合关键颜色的关键值编码。”
***第一次抛出时调用堆栈:
(
0 CoreFoundation 0x00ec6be9例外预处理+185
1 libobjc.A.dylib 0x00cbb5c2 objc_异常_抛出+47
2芯基础0x00ec6b21-[N异常升高]+17
3基金会0x000 086CF NSSETUSEKIKEVIESETER + 135
4基金会0x000 08633-[NSbObjs](NSKEY ValueCudid)SETValu:
5 UIKit 0x004a78d6-[UIRuntimeOutletConnection connect]+112
6 CoreFoundation 0x00e3d2cf-[NSArray makeObjectsPerformSelector:+239
7 UIKit 0x004a62ed-[UINib实例化所有者:选项:][1041
8 UIKit 0x004a8081-[NSBundle(UINSBUNDLEADTIONS)loadNibNamed:owner:options:+168
9 UIKit 0x00360a94-[UIViewController\u LoadViewFromNibName:bundle:][70
10 UIKit 0x0035e709-[UIViewController loadView]+120
11 UIKit 0x0035e5e3-[UIViewController视图]+56
12 UIKit 0x00371230-[UITabBarController从VIEWCONTROLLER:到VIEWCONTROLLER:转换:shouldSetSelected:+120
13 UIKit 0x0036fd86-[UITabBarController从VIEWCONTROLLER:到VIEWCONTROLLER:][64的转换
14 UIKit 0x00371b7e-[UITabBarController\u SETSELECTED VIEW CONTROLLER:+263
15 UIKit 0x003719ed-[UITabBarController_tabBarItemClicked:+352
16 UIKit 0x002b0a6e-[UIApplication sendAction:to:from:forEvent:][119
17 UIKit 0x004ae1f2-[UITabBar\u sendAction:withEvent:][422
18 UIKit 0x002b0a6e-[UIApplication sendAction:to:from:forEvent:][119
19 UIKit 0x0033f1b5-[UIControl发送操作:到:forEvent:+67
20 UIKit 0x00341647-[UIControl(内部)\u发送操作预防:withEvent:+527
21 UIKit 0x0033f16c-[UIControl发送操作控件事件:][49
22 UIKit 0x002b0a6e-[UIApplication sendAction:to:from:forEvent:][119
23 UIKit 0x0033f1b5-[UIControl发送操作:到:forEvent:+67
24 UIKit 0x00341647-[UIControl(内部)\u发送操作预防:withEvent:+527
25 UIKit 0x003401f4-[UIControl触摸已设定:带事件:][458
26 UIKit 0x002d50d1-[UIWindow\u sendTouchesForEvent:+567
27 UIKit 0x002b637a-[UIApplication sendEvent:+447
28 UIKit 0x002bb732 _UIApplicationHandleEvent+7576
29图形服务0x016dda36 PurpleEventCallback+1550
30 CoreFoundation 0x00ea8064\uuuuu CFRUNLOOP\u正在调用\uu OUT\uu以执行\uu函数\uuuu+52
31 CoreFoundation 0x00e086f7\uuU CFRunLoopDoSource1+215
32 CoreFoundation 0x00e05983 _ucfrunlooprun+979
33 CoreFoundation 0x00e05240 CFRUNLOOPSCRONE+208
34 CoreFoundation 0x00e05161 CFRUNLOOPSRUNINMODE+97
35图形服务0x016dc268 GSEventRunModal+217
36图形服务0x016dc32d GSEventRun+115
37 UIKit 0x002bf42e UIApplicationMain+1160
38拖船911 0x00001df8干管+102
39拖船911 0x00001d89启动+53
)
在抛出“NSException”实例后调用terminate
程序收到信号:“SIGABRT”。
谢谢大家的帮助

由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[setValue:forUndefinedKey:]:此类不符合密钥颜色的密钥值编码

在这种情况下,请检查以下各项:

  • 确保您没有拼错您试图访问的密钥,即颜色

  • 您试图访问的类属性(即颜色)应符合键值。您可以将该属性声明为标头中的属性,并在实现文件中合成该属性。不要更改属性声明中getter和setter的默认名称。默认方法名称/签名与KVC兼容。 关于KVC的Apple文档,包括访问器方法代码:

  • 如果您使用的是核心数据,请确保所访问的属性存在于相应的头文件中,并且其代码也存在于实现文件中。您可能在以后将此属性添加到模型中,而没有更新生成的头文件和实现文件

  • 在没有答案的情况下看到这篇文章,所以我想我会给出一个可能帮助其他人的回复