Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 views
in Technique[技术] by (71.8m points)

tableview - iphone app crash

I am getting an error while running app with following exception.

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
    )
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The error message: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key customCell.'

... means that your xib is referencing an IBOutlet named "customCell" but your view controller doesn't have that IBOutlet anymore. You either need to remove the customCell reference from your xib or add an IBOutlet property to your view controller named "customCell".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...