iDurocher
iDurocher

Reputation: 915

NSInvalidUnarchiveOperationException for GLKViewControllerPauseOnWillResignActiveCoderKey

After updating to xCode 5, I am getting the following error when running my application on iOS 5 and iOS 6 simulators. It does work fine on iOS 7. This code is unmodified from what did work prior to the xCode upgrade.

* Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '* -[NSKeyedUnarchiver decodeInt32ForKey:]: value for key (GLKViewControllerPauseOnWillResignActiveCoderKey) is not an integer number'

Many other older posts point to turning off AutoLayout, which I confirmed is off.

In the same project, I added a new storyboard and tested. The blank storyboard loaded fine. I then added a GLKView controller to the new storyboard and the same error came up.

Upvotes: 0

Views: 733

Answers (1)

Maxwell Robinson
Maxwell Robinson

Reputation: 11

I ran into this exact same issue. Auto Layout was causing issues when going from iOS 5 to 6, so it isn't the root of this issue. Instead, it looks like this type of problem occurs with general iOS compatibility problems. In this case it is some new issue with GLKViewController. I found another post which suggested changing the "Opens in..." setting on the storyboard to XCode 4.6, but this didn't fix the problem.

What ended up fixing it for me was removing storyboards altogether. For me, making a primarily C++ game with only 1 UIViewController in the entire project, and a simplistic storyboard, this worked fine and only took a minute.

To do this, you will need to go to project settings -> General -> Deployment Info and delete the value in "Main Interface". Then, in application:didFinishLaunchingWithOptions:, do something like this:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;

GameVC* gameVC = [[GameVC alloc] init];
self.window.rootViewController = gameVC;

[self.window makeKeyAndVisible];

return YES;

Upvotes: 1

Related Questions