私はこの問題に対する他の解決策を確認しましたが、どれもうまくいきませんでした。
物理iPhone(シミュレーターではありません。これはシミュレーターで機能します)でGKLocalPlayerを認証しようとすると、次のエラーが発生します。
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)
次のコードをViewControllerに追加しようとしましたが、何も変わりません。
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
このアプリケーションはランドスケープでのみ実行されることになっているため、GameCenterを介してプレーヤーを認証しようとした場合にのみ実行されることを確認できます。そのラインを外せば問題ありません。
編集
明確にするために、これは次のコードが実行されるときに発生します。
- (void)GKLogin
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.isAuthenticated)
{
NSLog(@"Authenticated");
}
else
{
NSLog(@"Not Authenticated");
}
}];
}