Exception thrown when touching thumbnail/transparent button


#1

I have written all the code in chapter 15 and when I now run the application in the iPad simulator, an exception is thrown. This is what it says:

*** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<ImageViewController 0x7180820> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key inageView.’

I wrote the wrong name (“inageView”) when I connected the views in ImageViewController.xib to imageViewController.h. Realizing this, before moving on I deleted the connection (or at least, the code in in the header file) and created a new one with the right name “imageView”. Due to the error message I get, I suspect that the former connection wasn’t removed properly. Could that be the case or can I have done something else?

I am thankful for any help!
Oscar


#2

Start from scratch and follow the book’s instructions carefully, without making mistakes, until you get it wright. It can be frustrating to do this, but you learn from it and get better each time.


#3

I had the same issue when doing the silver challenge. For me it was the connections from the .xib that were linked with object ‘File’s Owner’ in stead of the new cell object (in my case StepperCell).


#4

What connections and what xib-file are you talking about? I don’t really understand what you mean by “connections linked with the new cell object”. Sorry for my nooby questions, still new to objective-c (and programming in total) :wink:

As you understand, I still haven’t solved the problem. So if anyone has any other suggestions, please feel free to tell me :slight_smile:


#5

Also, be sure the button is listed under Homepwner Item Cell object when looking at the xib. I had this error at first. I believe it is because the compiler is looking for one object when it loads the nib. If the button is a separate to level object the view doesn’t know which one to load.


#6

I had the same issue. When I realized I’d made a typo after connecting in the assistant editor, I disconnected it, renamed it and made the connection again. But what i did not do was make sure the first referencing outlet was removed.
open imageViewController.xib ,
select imageView in the Objects outline view,
select the connections inspector (last button on the top right corner) and make sure there is only one referencing outlet. I had two. removed the typo’d one by clicking the “x” next to file’s owner and it worked fine.