问题
I'm getting an intermittent crash using Storyboards in iOS 5. Every so often, I get a SIGABRT when I try to instantiate a new object with a view controller from my Storyboard. It seems like a very generic error, but I can't find anyone else that's seen this. Thanks for your help!
SectionLandscapeViewController *sectionViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"SectionLandscapeViewController"];
And the crash...
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIProxyObject 0xa0fba20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key sceneViewController.'
回答1:
Open your .xib file for this controller and right click on "File Owner" and check if you have connected any wrong property or outlets. You will find a small yellow icon on the right side of outlet if it is a wrong one. Just remove that and try.
回答2:
I was able to fix this by doing a "Reset Content and Settings" in the IPhone Simulator.
回答3:
Running it in simulator:
Try Simulator -> Reset Content and Settings
On Device
Try deleting and reinstalling the app
回答4:
Try to use storyboard ID that different from real UIViewController class name.
来源:https://stackoverflow.com/questions/11047991/storyboard-crash-coding-compliant-key-sceneviewcontroller