A new flavor of the "this class is not key value coding-compliant for ..." error
A new flavor of the "this class is not key value coding-compliant for ..." error
- Subject: A new flavor of the "this class is not key value coding-compliant for ..." error
- From: Jay Reynolds Freeman <email@hidden>
- Date: Fri, 20 Aug 2010 12:29:04 -0700
This could be cocoa-related or Xcode-related, so I will
probably eventually do separate posts to the two lists, but
I thought I would start here.
I am using Xcode 3.2.2 to write an iPad app, using the SDKs that
came with it (all public to developers now), running on the simulator.
All is well, till I start simulating memory warnings.
Without memory warnings, I open my app in the simulator, then
immediately do an operation that causes a .xib file to load
and display a view (the .xib contains a subclass of a UIViewController
and the associated view), and all is well.
However, if I open my app in the simulator, then simulate a memory
warning, and then try to get the .xib file to load and display,
I get a crash with the error message:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<HelpViewController 0x4b5ba00> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key toolBar.'
There has been a lot of discussion of this error message on the web,
and most of the problems mentioned have had to do with misspelled
ivar names, incorrect links in the nib file set up in IB, and
the like. I think I have been through all of those: I have renamed
several ivars and rebuilt the entire .xib file from scratch, and
done a lot of code-walking.
What is more, all the errors I have read about on the web so far appear
to be of such nature as to cause a crash at load-nibfile time even
if I have *not* previously simulated a memory warning. The crash
I am encountering happens *only* when I have just simulated a memory
warning.
I temporarily overwrote and instrumented "loadView" with NSLog
(and included a call to [super loadView] to get the default behavior):
There was no change in the crash behavior, and it appears that the
crash occurs before loadView starts. (Then I excised the entire
code for the overwrite of loadView, so as to be sure I was not
getting into extra trouble for overwriting it when perhaps I shouldn't.
Also, I temporarily removed *all* code from the body of "dealloc"
-- not even a call to [super dealloc]: No change in crash behavior.
Also, I temporarily added an extra "retain" of the relevant controller,
not balanced by any release: No change in crash behavior.
It looks to me as if, in response to the memory warning, something
is forgetting something important about the class structure of
my subclassed UIViewController, but that is only a conjecture: I
really have no idea what is going on.
And oh, yes, the allegedly non-key-value-compliant ivar is in
fact declared in the header file as
IBOutlet UIToolbar *toolBar;
...
@property (nonatomic, retain ) IBOutlet UIToolbar *toolBar;
And then in the .mm file for the class I have
@synthesize toolBar;
Does anyone have any clues?
-- Jay Reynolds Freeman
---------------------
email@hidden
http://web.mac.com/jay_reynolds_freeman (personal web site)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden