Error


#1

I downloaded sample source code from your website because there seems to be a bug on the auto layout on my previous project, the thing is the sample project doesn’t work and i keep getting error like this

2014-05-12 15:24:06.697 HomePwner[2214:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<BNRDetailViewController 0x8d7daa0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key cameraButton.' *** First throw call stack: ( 0 CoreFoundation 0x017f61e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x015758e5 objc_exception_throw + 44 2 CoreFoundation 0x01885fe1 -[NSException raise] + 17 3 Foundation 0x01235d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282 4 Foundation 0x011a21d7 _NSSetUsingKeyValueSetter + 88 5 Foundation 0x011a1731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267 6 Foundation 0x01203b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412 7 UIKit 0x004ec1f4 -[UIRuntimeOutletConnection connect] + 106 8 libobjc.A.dylib 0x015877de -[NSObject performSelector:] + 62 9 CoreFoundation 0x017f176a -[NSArray makeObjectsPerformSelector:] + 314 10 UIKit 0x004ead4d -[UINib instantiateWithOwner:options:] + 1417 11 UIKit 0x003536f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280 12 UIKit 0x00353e9d -[UIViewController loadView] + 302 13 UIKit 0x003540d3 -[UIViewController loadViewIfRequired] + 78 14 UIKit 0x003545d9 -[UIViewController view] + 35 15 UIKit 0x0036e942 -[UINavigationController _startCustomTransition:] + 778 16 UIKit 0x0037b8f7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688 17 UIKit 0x0037c4e9 -[UINavigationController __viewWillLayoutSubviews] + 57 18 UIKit 0x004bd0d1 -[UILayoutContainerView layoutSubviews] + 213 19 UIKit 0x002a4964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 20 libobjc.A.dylib 0x0158782b -[NSObject performSelector:withObject:] + 70 21 QuartzCore 0x03c6145a -[CALayer layoutSublayers] + 148 22 QuartzCore 0x03c55244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 23 QuartzCore 0x03c550b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 24 QuartzCore 0x03bbb7fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 25 QuartzCore 0x03bbcb85 _ZN2CA11Transaction6commitEv + 393 26 QuartzCore 0x03bbd258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 27 CoreFoundation 0x017be36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 28 CoreFoundation 0x017be2bf __CFRunLoopDoObservers + 399 29 CoreFoundation 0x0179c254 __CFRunLoopRun + 1076 30 CoreFoundation 0x0179b9d3 CFRunLoopRunSpecific + 467 31 CoreFoundation 0x0179b7eb CFRunLoopRunInMode + 123 32 GraphicsServices 0x037ea5ee GSEventRunModal + 192 33 GraphicsServices 0x037ea42b GSEventRun + 104 34 UIKit 0x00235f9b UIApplicationMain + 1225 35 HomePwner 0x00005e7d main + 141 36 libdyld.dylib 0x01e3d701 start + 1 ) libc++abi.dylib: terminating with uncaught

Please help. I got the source code on the 16th chapter to start fresh in this new chapter


#2

Whenever you see “this class is not key value coding-compliant for the key”, that almost always is going to be an issue with your XIB. Open BNRDetailViewController and right click on “File’s Owner” and look for a warning next to “cameraButton”. You’ll want to remove that connection.

This usually happens when you manually rename something without using the Refactor tool, but can be caused a few other ways as well.


#3

Found out the problem valueLabel wasn’t connected.