0

I am fairly new to Xcode and am trying to have the root view controller push to a xib and have the following code:

self.window.rootViewController = [[UIViewController alloc]initWithNibName:@"PremiumView" bundle:nil];

However, no matter where I push it the app crashes and tells me "this class is not key value coding-compliant for the key". Can anyone help point me in the right direction and figure out what is wrong. Thanks in advance.

user3255746
  • 1,377
  • 3
  • 12
  • 13
  • Possible duplicate of [What does this mean? "'NSUnknownKeyException', reason:This class is not key value coding-compliant for the key X"](http://stackoverflow.com/questions/3088059/what-does-this-mean-nsunknownkeyexception-reasonthis-class-is-not-key-valu) – Larme Mar 29 '16 at 14:50
  • what are you trying to do ? set root view controller ? or present a xib ? – Teja Nandamuri Mar 29 '16 at 14:50
  • Hi. May I ask why you are trying to change the rootViewController after pushing? – GoGreen Apr 05 '16 at 05:36

1 Answers1

2

Assuming you are not using Storyboards and you are using stand-alone XIBs:

Make sure that your ViewController has the correct class name in Interface Builder.

Also make sure that any outlets in that .xib file are connected correctly with your code. If there are any left over connections, you might get that error.

Usually this happens if you connect an IBOutlet and then delete the reference from the .h/.m file.

Hope that helps... Also check: What does this mean? "'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X"

Community
  • 1
  • 1