I have checked other solutions to this problem and none have worked for me.
If I try to authenticate a GKLocalPlayer on my physical iPhone (not the simulator; this works in the simulator), I get the following error:
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:
(0x373463e7 0x33d7e963 0x37346307 0x3815b857 0x382fff21 0x381dfcdd
0x381def6b 0x37349ad4 0x372a128f 0x382fd0f3 0x32acce01 0x30a19793
0x30a195db 0x30a1ce45 0x3731a1b1 0x3728d23d 0x3728d0c9 0x315d733b
0x38147291 0x101a73 0x1019d0)
I have tried to add the following code to the view controller, but nothing changes:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
This application is only supposed to run in landscape and I can confirm that it only happens when I try to authenticate a player through Game Center. If I take that line out, there are no problems.
EDIT
To clarify, this happens when the following code runs:
- (void)GKLogin
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.isAuthenticated)
{
NSLog(@"Authenticated");
}
else
{
NSLog(@"Not Authenticated");
}
}];
}
try this in application delegate