<p>I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging.
Essentially my app displays an image and when touched plays a short sound.
When compiling and building the project in XCode, everything builds successfully, but when the app is run in the iPhone simulator, it crashes.</p>

<p>I get the following error:</p>

<pre><code>Application Specific Information:
iPhone Simulator 1.0 (70), iPhone OS 2.0 (5A331)
*** Terminating app due to uncaught exception 'NSUnknownKeyException', 
reason: '[&lt;UIView 0x34efd0&gt; setValue:forUndefinedKey:]: this class is not key value 
coding-compliant for the key kramerImage.'
</code></pre>

<p>kramerImage here is the image I'm using for the background.</p>

<p>I'm not sure what NSUnknownKeyException means or why the class is not key value coding-compliant for the key.</p>

[{'answer_id': 46357, 'author': 'amrox', 'author_id': 4468, 'author_profile': 'https://Stackoverflow.com/users/4468', 'pm_score': 6, 'selected': True, 'text': '<p>(This isn\'t really iPhone specific - the same thing will happen in regular Cocoa).</p>\n\n<p>NSUnknownKeyException is a common error when using <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/KeyValueCoding.html" rel="nofollow noreferrer">Key-Value Coding</a> to access a key that the object doesn\'t have.</p>\n\n<p>The properties of most Cocoa objects can be accessing directly:</p>\n\n<pre><code>[@"hello world" length]    // Objective-C 1.0\n@"hello world".length      // Objective-C 2.0\n</code></pre>\n\n<p>Or via Key-Value Coding:</p>\n\n<pre><code>[@"hello world" valueForKey:@"length"]\n</code></pre>\n\n<p>I would get an NSUnknownKeyException if I used the following line:</p>\n\n<pre><code>[@"hello world" valueForKey:@"purpleMonkeyDishwasher"]\n</code></pre>\n\n<p>because NSString does not have a property (key) called \'purpleMonkeyDishwasher\'.</p>\n\n<p>Something in your code is trying to set a value for the key \'kramerImage\' on an UIView, which (apparently) doesn\'t support that key.  If you\'re using Interface Builder, it might be something in your nib.</p>\n\n<p>Find where \'kramerImage\' is being used, and try to track it down from there.</p>\n'}, {'answer_id': 2538217, 'author': 'Ozkan Altuner', 'author_id': 178473, 'author_profile': 'https://Stackoverflow.com/users/178473', 'pm_score': 3, 'selected': False, 'text': "<p>Also when you rename a view, don't forget to delete the reference on File's Owner. It may also raise this error.</p>\n"}, {'answer_id': 3899224, 'author': 'Owen Hartnett', 'author_id': 69724, 'author_profile': 'https://Stackoverflow.com/users/69724', 'pm_score': 3, 'selected': False, 'text': '<p>Here\'s one where you\'ll get this error - and how to fix it.  I was getting it when loading a nib that just had a custom TableViewCell.  I used IB to build a xib that just had the File\'s Owner, First Responder, and the TableViewCell. The TableViewCell just had 4 UILabels which matched up to a class with 4 IBOutlet UILabels called rootCell.  I changed the class of the TableViewCell to be rootCell.  It worked fine until a made a couple of changes and suddenly I was getting the setValue:forUndefinedKey: when I was just instantiating the class after loading it from a nib:</p>\n\n<pre><code>    NSArray * nib = [[NSBundle mainBundle] loadNibNamed:@"rootCell-iPad" owner:self options:nil];\n\n    cell = [nib objectAtIndex:0];\n</code></pre>\n\n<p>It failed at the first line, when the nib was trying to load.  After a while, I noticed that it was trying to match the IBOutlet Labels to the root controller, NOT the rootCell class!  That was my tipoff.  What I did wrong was to inadvertently change the File\'s Owner to rootCell class.  When I changed it back to NSObject, then it didn\'t try to match up to the delegate (rootController) when loading.  So, if you\'re doing the above, make File\'s Owner an NSObject, but make the UITableCell your desired class.</p>\n'}, {'answer_id': 4143957, 'author': 'Vipul Parmar', 'author_id': 496955, 'author_profile': 'https://Stackoverflow.com/users/496955', 'pm_score': 0, 'selected': False, 'text': '<p>It seems you are doing</p>\n\n<pre><code>@interface MyFirstIphoneAppViewController : UIViewController&lt;&gt; {\n    UIImageView *InitialkramerImage;\n}\n@property(nonatomic,retain) IBOutlet UIImageView *InitialkramerImage;\n</code></pre>\n\n<p>Then after synthesizing that imageview, When you open "MyFirstIphoneAppViewController.xib" in Interface Builder, you are taking an Image View from Tool(menu)/Library den linking that outlet to the \'InitialkramerImage\' from the Files Owner of "MyFirstIphoneAppViewController.xib". Then you saved the project. But after that you might change the name of the outlet variable "InitialkramerImage" to "kramerImage". So, after doing this </p>\n\n<pre><code>@interface MyFirstIphoneAppViewController : UIViewController&lt;&gt; {\n    UIImageView *kramerImage;\n}\n@property(nonatomic,retain) IBOutlet UIImageView *kramerImage;\n</code></pre>\n\n<p>and saving the project when you run it, There is no existance of the outlet of "InitialkramerImage" in the "MyFirstIphoneAppViewController.xib". So, when you run the project there will be no outlet referencing from Imageview to the \'kramerImage\' and </p>\n\n<blockquote>\n  <p>"For displaying the view,\n  UIViewController will try to find the\n  outlet to "InitialkramerImage" which\n  is not existing."</p>\n</blockquote>\n\n<p>So, It will throw the "NSUnknownKeyException". </p>\n\n<blockquote>\n  <p>You can check the missing outlet by\n  opening the nib(.xib) file then right\n  clicking on the \'Files Owner\' of that.</p>\n</blockquote>\n'}, {'answer_id': 6600238, 'author': 'gonzobrains', 'author_id': 267702, 'author_profile': 'https://Stackoverflow.com/users/267702', 'pm_score': 2, 'selected': False, 'text': "<p>I had this same problem today.  I didn't have the right class specified for the View Controller in my Navigation Controller.  This will happen often if you fail to specify the correct class for your views in Interface Builder.</p>\n\n<p>You'll also get invalid selector issues as well.  Always check your Interface Builder classes and connections!</p>\n"}, {'answer_id': 10509814, 'author': 'KETAN', 'author_id': 608227, 'author_profile': 'https://Stackoverflow.com/users/608227', 'pm_score': 0, 'selected': False, 'text': '<p>If you have done this code somewhere else and had a zip/compressed file, try to extract it again. It may work I dont know why but I feel like it is an extraction issue.</p>\n\n<p>or you can try to change the IBOutlet to kramerImage and bind it again in NIB.</p>\n'}, {'answer_id': 11380108, 'author': 'Leon', 'author_id': 1509483, 'author_profile': 'https://Stackoverflow.com/users/1509483', 'pm_score': 2, 'selected': False, 'text': '<p>I had this situation and it turns out even after finding all instances of the variable and deleting them my app still crashed.  Heres what happened... I created another instance of a variable from a textfield from my  XIB into my viewController.h but I realized I didnt need it anymore and deleted it.  It turns out my program saw that and kept trying to use it in the program so in the future if this happens to anywhere else just go into you XIB right-click on the button or textfield etc and delete any extra unused variables.</p>\n'}, {'answer_id': 11543751, 'author': 'Joseph', 'author_id': 1535134, 'author_profile': 'https://Stackoverflow.com/users/1535134', 'pm_score': 2, 'selected': False, 'text': '<p>This is how i solved mine, in Interface builder right-click the View Controller, there should be an exclamation mark on the missing outlet or action method. Find and remove all the references and that solved it.</p>\n\n<p>This happened because i deleted the action method in the .m file.</p>\n'}]
['https://Stackoverflow.com/questions/46220', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2293/']