如何在Xcode中删除“用户定义的运行时属性”,它们是什么?

时间:2013-11-24 20:16:52

标签: ios xcode attributes xcode5

在Xcode 5.0.2中,我创建了一个新的Master-Detail应用程序 - 它在iPhone和iPad模拟器上运行良好。

但是在Xcode的右侧面板中意外地在用户定义的运行时属性中我点击了(三次)一个加号并添加了“keyPath”条目(没有真正理解它们是什么):< / p>

enter image description here

我该如何删除它们?单击减号不会改变任何内容,现在在模拟器中运行失败:

2013-11-24 21:02:53.003 MDExample[23132:a0b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableView 0xab26000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0173c5e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x014bf8b6 objc_exception_throw + 44
    2   CoreFoundation                      0x017cc6a1 -[NSException raise] + 17
    3   Foundation                          0x011809ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x010eccfb _NSSetUsingKeyValueSetter + 88
    5   Foundation                          0x010ec253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   UIKit                               0x00297e0b -[UIView(CALayerDelegate) setValue:forKey:] + 168
    7   Foundation                          0x0114e70a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
    8   UIKit                               0x007aa0c5 -[UINibKeyValuePair apply] + 70
    9   libobjc.A.dylib                     0x014d17d2 -[NSObject performSelector:] + 62
    10  CoreFoundation                      0x01737b6a -[NSArray makeObjectsPerformSelector:] + 314
    11  UIKit                               0x004ce552 -[UINib instantiateWithOwner:options:] + 1389
    12  UIKit                               0x00340605 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
    13  UIKit                               0x00340dad -[UIViewController loadView] + 302
    14  UIKit                               0x004e911e -[UITableViewController loadView] + 80
    15  UIKit                               0x003410ae -[UIViewController loadViewIfRequired] + 78
    16  UIKit                               0x003415b4 -[UIViewController view] + 35
    17  UIKit                               0x0036bca9 -[UINavigationController rotatingSnapshotViewForWindow:] + 52
    18  UIKit                               0x00695a60 -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 420
    19  UIKit                               0x002712f2 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 1495
    20  UIKit                               0x00270d16 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
    21  UIKit                               0x00270be8 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
    22  UIKit                               0x00270c70 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
    23  UIKit                               0x0026fd0a __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
    24  UIKit                               0x0026fc6c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
    25  UIKit                               0x002709c3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
    26  UIKit                               0x00273fb6 -[UIWindow setDelegate:] + 449
    27  UIKit                               0x00345737 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
    28  UIKit                               0x00269c1c -[UIWindow addRootViewControllerViewIfPossible] + 609
    29  UIKit                               0x00269d97 -[UIWindow _setHidden:forced:] + 312
    30  UIKit                               0x0026a02d -[UIWindow _orderFrontWithoutMakingKey] + 49
    31  UIKit                               0x0027489a -[UIWindow makeKeyAndVisible] + 65
    32  UIKit                               0x00227cd0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1851
    33  UIKit                               0x0022c3a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
    34  UIKit                               0x0024087c -[UIApplication handleEvent:withNewEvent:] + 3447
    35  UIKit                               0x00240de9 -[UIApplication sendEvent:] + 85
    36  UIKit                               0x0022e025 _UIApplicationHandleEvent + 736
    37  GraphicsServices                    0x036932f6 _PurpleEventCallback + 776
    38  GraphicsServices                    0x03692e01 PurpleEventCallback + 46
    39  CoreFoundation                      0x016b7d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    40  CoreFoundation                      0x016b7a9b __CFRunLoopDoSource1 + 523
    41  CoreFoundation                      0x016e277c __CFRunLoopRun + 2156
    42  CoreFoundation                      0x016e1ac3 CFRunLoopRunSpecific + 467
    43  CoreFoundation                      0x016e18db CFRunLoopRunInMode + 123
    44  UIKit                               0x0022badd -[UIApplication _run] + 840
    45  UIKit                               0x0022dd3b UIApplicationMain + 1225
    46  MDExample                           0x00003b3d main + 141
    47  libdyld.dylib                       0x01d78725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

1 个答案:

答案 0 :(得分:1)

用户定义的运行时属性就是:用户定义的键路径,在给定类/控件的标准接口构建器编辑器中可能不可用。当您单击添加一个时,您指示NIB除霜器调用setValue:forKey:,在这种情况下使用密钥路径keyPath和值NO(或更确切地说,@NO)。当然,由于UITableView没有名为keyPath的密钥路径或属性,因此KVC机制将崩溃。

要删除一个,必须突出显示,然后删除键或“减号”按钮才能起作用:

enter image description here

如果问题仍然存在,请file a bug report