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
}
}];
}
精彩评论