This Class Is Not Key Value Coding-Compliant for the Key Xxxxxx

this class is not key value coding-compliant for the key XXXXXX

Can't be sure if this is what's happening in your case, but you'll commonly see this message if you have a connection set up in your nibs to assign an object to a property of another object, but the property is missing on the target object.

So you might have had an IBOutlet named aproposViewController on LoadingViewController at one point, connected another view controller to it in the nib, and then removed the IBOutlet but neglected to remove the connection in the nib.

So when the nib is loaded, it tries to set the property, only to find it doesn't exist, hence:

reason: '[<LoadingViewController 0x6b2c5a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aproposViewController.'

this class is not key value coding-compliant for the key setOutput

Go to your ViewController xib/Storyboard right click on the File's Owner you should find a yellow alert icon there delete that connection , it should solve your problem.

this class is not key value coding-compliant for the key screenNumber

OK, found the issue. The simulator still had old files in it. Deleted home/Preferences/Application Support/iPhone Simulator/7.1/Applications/.

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X error?

Your view controller may have the wrong class in your xib.

I downloaded your project.

The error you are getting is

'NSUnknownKeyException', reason: '[<UIViewController 0x3927310> 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.

Another possible reason for this error: when copying & pasting elements from one controller into another, Xcode somehow keeps that link to the original controller, even after editing & relinking this element into the new controller.

Another possible reason for this error:

Bad Outlet.

You have either removed or renamed an outlet name in your .h file.

Remove it in .xib or .storyboard file's Connection Inspector.

One more possible reason

(In my case) Extension of UIView with bindable properties and setting values for those bindable properties (i.e. shadow, corner radius etc.) then remove those properties from UIView extension (for some reason) but the following <userDefinedRuntimeAttributes> remained in xml (of foo.storyboard):

<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
<real key="value" value="50"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="point" keyPath="shadowOffset">
<point key="value" x="5" y="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
<real key="value" value="16"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidthValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>

Solution: Right click on foo.storyboard > Open as Source Code > search by keyPath (i.e. shadowRadius) > Delete the </userDefinedRuntimeAttributes> that causing the problem

What does this debugging message mean?

The error can be due to the following reasons:

  1. You have assigned inccorect class to your view controller.
  2. The property(in your case highScore) might be deleted from the class but is still hooked up in IB.

Make sure that you have done the above correctly.

Navigate to loginViewController when Session facebook login is closed

you should load LoginUIViewController from storyboard

LoginUIViewController *viewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginUIViewController"];

check this Instantiate a view controller using a storyboard identifier

create a View Controller defined in you your Storyboard programmatically

UITabBarItem action giving NSException

This is not problem action. This is problem loading viewcontroller from storyboard. You have IBOutlet with name NearbyHotelsButton. But you viewcontroller does not have this property.



Related Topics



Leave a reply



Submit