【问题标题】:iphone app crashiphone应用程序崩溃
【发布时间】:2011-06-20 20:29:15
【问题描述】:

我在运行应用程序时遇到错误,出现以下异常。

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FavoriteViewController 0x158d30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key customCell.'
    *** Call stack at first throw:
    (
        0   CoreFoundation                      0x314d0987 __exceptionPreprocess + 114
        1   libobjc.A.dylib                     0x319a149d objc_exception_throw + 24
        2   CoreFoundation                      0x314d0705 -[NSException dealloc] + 0
        3   Foundation                          0x31d28b4f -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 182
        4   Foundation                          0x31d2803b _NSSetUsingKeyValueSetter + 90
        5   Foundation                          0x31d29da3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
        6   Foundation                          0x31cdbb17 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 130
        7   UIKit                               0x33a8860f -[UIRuntimeOutletConnection connect] + 66
        8   CoreFoundation                      0x31473fc7 -[NSObject(NSObject) performSelector:] + 18
        9   CoreFoundation                      0x3147cd51 -[NSArray makeObjectsPerformSelector:] + 388
        10  UIKit                               0x33a87577 -[UINib instantiateWithOwner:options:] + 586
        11  UIKit                               0x33a88b39 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
        12  Fridge                              0x0001ab11 -[FavoriteViewController tableView:cellForRowAtIndexPath:] + 192
        13  UIKit                               0x33907a21 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 516
        14  UIKit                               0x339077f3 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 34
        15  UIKit                               0x33905d2d -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 936
        16  UIKit                               0x33904edd -[UITableView layoutSubviews] + 140
        17  UIKit                               0x338b10cf -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
        18  CoreFoundation                      0x3146ebbf -[NSObject(NSObject) performSelector:withObject:] + 22
        19  QuartzCore                          0x30a6c685 -[CALayer layoutSublayers] + 120
        20  QuartzCore                          0x30a6c43d CALayerLayoutIfNeeded + 184
        21  QuartzCore                          0x30a6656d _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212
        22  QuartzCore                          0x30a66383 _ZN2CA11Transaction6commitEv + 190
        23  QuartzCore                          0x30a89f9d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
        24  CoreFoundation                      0x31460c59 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
        25  CoreFoundation                      0x31460acd __CFRunLoopDoObservers + 412
        26  CoreFoundation                      0x314580cb __CFRunLoopRun + 854
        27  CoreFoundation                      0x31457c87 CFRunLoopRunSpecific + 230
        28  CoreFoundation                      0x31457b8f CFRunLoopRunInMode + 58
        29  GraphicsServices                    0x35d664ab GSEventRunModal + 114
        30  GraphicsServices                    0x35d66557 GSEventRun + 62
        31  UIKit                               0x338d5329 -[UIApplication _run] + 412
        32  UIKit                               0x338d2e93 UIApplicationMain + 670
        33  Fridge                              0x00002d77 main + 70
        34  Fridge                              0x00002d2c start + 40
    )

【问题讨论】:

    标签: iphone tableview


    【解决方案1】:

    错误消息:由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[setValue:forUndefinedKey:]:此类与键 customCell 的键值编码不兼容。”

    ... 表示您的 xib 正在引用名为“customCell”的 IBOutlet,但您的视图控制器不再具有该 IBOutlet。您要么需要从 xib 中删除 customCell 引用,要么将 IBOutlet 属性添加到名为“customCell”的视图控制器。

    【讨论】:

      猜你喜欢
      • 2011-06-16
      • 1970-01-01
      • 1970-01-01
      • 2012-03-07
      • 2016-01-25
      • 2011-10-06
      • 2010-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多