Doug Molineux
Doug Molineux

Reputation: 12431

Xcode error for iPhone app: this class is not key value coding-compliant

My new iPhone app loads but then it crashes right away, in the console I get this reason:

reason: '[<MyViewController 0x6939d60> setValue:forUndefinedKey:]:this class is not key value coding-compliant for the key delegate.'

Stack:

    *** Call stack at first throw:
(
    0   CoreFoundation                      0x0273cb99 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0288c40e objc_exception_throw + 47
    2   CoreFoundation                      0x0273cad1 -[NSException raise] + 17
    3   Foundation                          0x000310f3 _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x00031061 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x004af70a -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x026b2d0f -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x004ae121 -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x004afeb5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x0036595f -[UIViewController _loadViewFromNibNamed:bundle:] + 70
    10  UIKit                               0x00363675 -[UIViewController loadView] + 120
    11  UIKit                               0x0036354f -[UIViewController view] + 56
    12  HalloweenNoise                      0x0000238d -[MyAppDelegate application:didFinishLaunchingWithOptions:] + 74
    13  UIKit                               0x002b9f27 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    14  UIKit                               0x002bc3b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
    15  UIKit                               0x002c63ec -[UIApplication handleEvent:withNewEvent:] + 1958
    16  UIKit                               0x002beb3c -[UIApplication sendEvent:] + 71
    17  UIKit                               0x002c39bf _UIApplicationHandleEvent + 7672
    18  GraphicsServices                    0x0301c822 PurpleEventCallback + 1550
    19  CoreFoundation                      0x0271dff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    20  CoreFoundation                      0x0267e807 __CFRunLoopDoSource1 + 215
    21  CoreFoundation                      0x0267ba93 __CFRunLoopRun + 979
    22  CoreFoundation                      0x0267b350 CFRunLoopRunSpecific + 208
    23  CoreFoundation                      0x0267b271 CFRunLoopRunInMode + 97
    24  UIKit                               0x002bbc6d -[UIApplication _run] + 625
    25  UIKit                               0x002c7af2 UIApplicationMain + 1160
    26  My                      0x00002320 main + 102
    27  My                      0x000022b1 start + 53

Here's my IBOutlet References (I think):

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet MyViewController *viewController;

What does this error mean?

Upvotes: 0

Views: 334

Answers (3)

John Franklin
John Franklin

Reputation: 4912

Open up your XIB in IB and look at the MyViewController's links. There will be an inbound link to "delegate" that you need to delete.

Upvotes: 3

JoBu1324
JoBu1324

Reputation: 7769

Make sure your outlets are connected properly in IB - I've had this error when I change the name of an IBOutlet, but forget to change the connection in IB to the new IBOutlet (it's still trying to connect to the old variable name)

Upvotes: 2

Lou Franco
Lou Franco

Reputation: 89142

Your view controller shouldn't be marked IBOutlet probably. Didn't it give you a stacktrace -- with the file and line# of the code that's having this issue?

What are you doing with the ViewController outlet? Did you connect that to something in IB?

Upvotes: 2

Related Questions