This class is not key value coding-compliant for the key?

I downloaded your project The error you are getting is NSUnknownKeyException', reason: ' setValue:forUndefinedKey:: this class is not key value coding-compliant for the key string It is caused by the Second view controller in MainWindow. Xib having a class of UIViewController instead of SecondView Changing to the correct class resolves the problem By the way, it is bad practice to have names like "string" in Objective-C. It invites a runtime naming collision.

Avoid them even in once off practice apps. Naming collisions can be very hard to track down and you don't want to waste the time.

I downloaded your project. The error you are getting is 'NSUnknownKeyException', reason: ' setValue:forUndefinedKey:: this class is not key value coding-compliant for the key string. ' It is caused by the Second view controller in MainWindow.

Xib having a class of UIViewController instead of SecondView. Changing to the correct class resolves the problem. By the way, it is bad practice to have names like "string" in Objective-C.It invites a runtime naming collision.

Avoid them even in once off practice apps. Naming collisions can be very hard to track down and you don't want to waste the time.

Stackoverflow to the rescue again. :) – Toby Allen Mar 7 at 21:03 do you have any idea how cool you are! I had the same problem and I found my MainWindow.

Xib files Tab Bar Controller had it's first view controller set to UIViewControl instead of my class. Thanks for posting this! – jspooner May 4 at 18:12 3 Yes, I do know how cool I am.

;-) – TechZen May 4 at 19:35 Super answer. Amazing how this is not covered that much . – jini May 12 at 3:01 Also do not forget to connect the "view" outlet of the nib to the file owner's view outlet (The view outlet of your custom class inherited from UIViewController).

This can be done by control dragging from "File's Owner" under "Place Holders" to "view" under "Objects" and selecting the view outlet. – Nirma Aug 11 at 14:49.

I had the same problem and while TechZen's answer may indeed be amazing I found it hard to apply to my situation. Eventually I resolved the issue by linking the label via the Controller listed under Objects (highlighted in the image below) rather then via the File Owner. Hope this helps.

You only need to specify IBOutlet once, the IBOutlet label your ivar is unnecessary. Are you instantiating your NIB using your UIViewController? At some point you should be calling SecondView initWithNibName:@"yourNibName" bundle:nil.

This helped! I was getting a key-value coding compliance error about a property from a different view controller. Turns out I was calling -initWithNibName with the wrong nib name.

– jlstrecker Oct 25 at 18:11.

Another "not compliant" issue I found was when I managed to have two copies of a class for some reason. I was adding keys to the wrong copy. Interface Builder still saw the keys and let me hook up to them, but at runtime it was using the other copy of the class that didn't have the new keys.To find which was the "right" copy I used XCode's cmd-click on the class name elsewhere to jump to the correct copy, then I killed off the bad unused copies (after bringing over my edits from the un-used copy first).

Moral of the story: duplicate class files are bad.

Updated with project source. – Echilon May 16 at 17:27.

I had a similar problem for a project that has two targets (with their own MainWindow XIB). The fundamental issue that caused this error for me was that the UIViewController class wasn't included in the second project's resource list. I.e.

Interface builder allowed me to specify it in MainWindow. Xib, but at runtime the system couldn't locate the class. I.e.

Cmd-click on the UIViewController class in question and double-check that it's included in the 'Targets' tab.

I was getting this error with storyboards. The above solution didn't seem to be the problem so I ended up deleting the view controller and adding it back in again (and of course reconnecting the segue and reassigning the class) which fixed it. I don't know what it really was, but I had renamed the associated view controller class shortly before this started, so maybe that had hosed something.

I've had this error many times. While TechZen's answer is absolutely right in this case, another common cause is when you change the name of a IBOutlet property in your . H/.

M which you've already connected up to File's Owner in the nib. From your nib, select the object in IB and go to the 'Connections Inspector'. Under 'Referencing Outlets' make sure that your object isn't still connected to the old property name...if it is, click the small 'x' to delete the reference and build again.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions