アプリがGameCenterに接続できるように設定しました。私はこのガイドに従い、他のクラスでそれらを呼び出すためのC++クラスラッパーを持っていました。テストにはiPad(iOS 5.1)、iPod Touch 4th Gen(iOS 5.1)、iPhone4sおよび3GSを使用しています。iPadデバイスでは正常に動作しますが、不明な理由により、iPhoneおよびiPodでは動作しません。サンドボックスに正しく接続されていますが、UIが表示されていないか、UIが画面外にあります。
iPhoneで何が起こるかは次のとおりです。
- ログインしていない状態でGameCenterにアクセスすると、ログインウィンドウが表示されます。ログインしても何も起こりません。ただし、コンソールにはビューが追加されたと表示されます。
- ログインしてGameCenterにアクセスしても、何も起こりません。ただし、コンソールにはビューが追加されたと表示されます。
- 認証を受ける前にGameCenterにアクセスすると、GameCenterUIが表示されます。でも...
- Game Centerは横向きモードですが(私のアプリは横向きなので問題ありません)、トップバー([完了]ボタンのあるバー)は、向きが縦向きであるかのように配置されます。
- UI全体は表示されず、画面の約30%しか表示されません。
これが私がGameCenterUIを起動する方法です:
- (void)showLeaderboardForCategory:(NSString *)category
{
// Only execute if OS supports Game Center & player is logged in
if ( hasGameCenter )
{
// Create leaderboard view w/ default Game Center style
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
// If view controller was successfully created...
if (leaderboardController != nil)
{
// Leaderboard config
leaderboardController.leaderboardDelegate = self; // The leaderboard view controller will send messages to this object
leaderboardController.category = category; // Set category here
leaderboardController.timeScope = GKLeaderboardTimeScopeToday; // GKLeaderboardTimeScopeToday, GKLeaderboardTimeScopeWeek, GKLeaderboardTimeScopeAllTime
// Create an additional UIViewController to attach the GKLeaderboardViewController to
myViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil ];
// Add the temporary UIViewController to the main OpenGL view
// NOTE: This is the part that I think is the suspect. I am not sure if iPhones and iPods support EAGLView.
[ [ EAGLView sharedEGLView ] addSubview:myViewController.view ];
// Tell UIViewController to present the leaderboard
[ myViewController presentModalViewController:leaderboardController animated:NO ];
NSLog( @"Leaderboard opened." );
}
}
}
どんな助けでもありがたいです、そして前もって感謝します。
編集:OpenFeintを使用することはオプションではありません。