开发者

How to check when GameKit UI displays

开发者 https://www.devze.com 2023-03-16 01:31 出处:网络
I\'ve got very simple game that I\'m trying to connect to Game Center. After calling: GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

I've got very simple game that I'm trying to connect to Game Center.

After calling:

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {

}];

First time, Game Center dialog comes up asking for username and password and afte开发者_如何学Gor that the whole Game Center windows slides up to set up account.

The problem is that my game is still running underneath that window and I just can not find any notifications to pause it.

viewWillDisappear, viewDidDisappear in UIViewController don't get called; applicationWillResignActive in AppDelegate is not called either.

Is there any way to detect that Game Center windows shows up?


Could you start the game after the user is authenticated?

Here would be an example from Apple's Docs (http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Users/Users.html)

- (void) authenticateLocalPlayer
{
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
    [localPlayer authenticateWithCompletionHandler:^(NSError *error) {
         if (localPlayer.isAuthenticated)
         {
             // Start Game
         }
     }];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消