Crash when initializing Game Center on iOS 6
by Joe Williams · in iTorque 2D · 12/06/2012 (7:55 pm) · 6 replies
I'm getting a crash when I initialize Game Center. It's happening on my iOS 6 device and, unfortunately, I don't have an earlier iOS device to check on. It does work in the simulator, though. I'm doing what the documentation says to do by calling this at the end of startGame in game.cs:
When I do, I get this from the debug output in Xcode:
As you can see from the "if" on the initialization snippet, I've modified my code a bit to support the ipad3 (using John Vanderbeck's code form here) and the iphone 5 using my own code (with some help from Johnny Vo).
Has anyone else had this problem? Does anyone know what has changed between iOS 5 and iOS 6 with regard to Game Center?
if($platform $= "iphone" || $platform $= "ipad" || $platform $= "iphone4" || $platform $= "ipad3" || $platform $= "iphone5")
{
// Initialize Game Center
initGameCenter();
}When I do, I get this from the debug output in Xcode:
2012-12-06 20:34:49.211 Rocket Elf[10064:907] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES' *** First throw call stack: (0x379532a3 0x35c7d97f 0x379531c5 0x38e7f88f 0x39024579 0x38f03d3d 0x38f02fc7 0x379569c4 0x378adfeb 0x39021733 0x337ebd2d 0x34c0f11f 0x34c0e4b7 0x34c131bd 0x37926f3b 0x37899ebd 0x37899d49 0x366d02eb 0x38e6b2f9 0x4a6c40 0x34d48b20) libc++abi.dylib: terminate called throwing an exception
As you can see from the "if" on the initialization snippet, I've modified my code a bit to support the ipad3 (using John Vanderbeck's code form here) and the iphone 5 using my own code (with some help from Johnny Vo).
Has anyone else had this problem? Does anyone know what has changed between iOS 5 and iOS 6 with regard to Game Center?
About the author
Recent Threads
#2
12/08/2012 (5:04 pm)
You're right, Johnny, my app is Landscape only. That code fixed the issue, though. Thanks!
#3
12/13/2012 (6:49 pm)
Okay, now there's another problem. On iOS 5, everything is fine. On iOS 6, Game Center doesn't seem to actually initialize. On iOS 5, the New Account prompt pops up. On iOS 6, nothing happens. Anyone have any idea why that might be?
#4
12/13/2012 (8:16 pm)
I got it working on iPad. I had to add Portrait orientation support in the project Summary. Doing the same for iPod/iPhone didn't fix it for those devices, though.
#5
12/13/2012 (9:07 pm)
Okay, weirdness: Game Center initializes normally if I launch the app in Landscape Right on the iPod/iPhone. It does not initialize at all if I launch the app in Landscape Left.
#6
12/13/2012 (9:33 pm)
I've decided to just lock everything to Landscape Right and call it good. I got it to work with Landscape Left, but it has that problem that's fixed by Paul Jan's UIKit thing and I could never get that working for some reason.
Torque Owner Johnny Vo
Put this code in TGAppDelegate.mm file and it should fix the problem.
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) return UIInterfaceOrientationMaskAll; else // iPhone return UIInterfaceOrientationMaskAllButUpsideDown; }