Search code examples
iphoneiosauthenticationgame-centergamekit

I can't get the GK authentication dialog to come up


I am really struggling with game center right now. It could be because GK as a whole has been pooping out all day (letterpress was just released!), but I can't get an auth dialog to come up:

- (void) authenticateLocalPlayer
{
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
    localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error)      {
    if (viewController) {
        NSLog(@"Foo 1");
        [self presentViewController:viewController animated:YES completion:nil];
    } else if (localPlayer.isAuthenticated) {
        NSLog(@"Foo 2");
    } else {
        NSLog(@"Foo 3");
    }
};
}

This method is hooked up to a button. When I press it, I get this in the console:

<Info>: 23:41:52.226407 com.apple.AVConference: GKSConnSettings: set server: {
    "gk-cdx" = "17.173.254.218:4398";
    "gk-commnat-cohort" = "17.173.254.220:16386";
    "gk-commnat-main0" = "17.173.254.219:16384";
    "gk-commnat-main1" = "17.173.254.219:16385";
}

Only the third option is being printed out: Foo 3. I am going nuts here. What is going on?


Solution

  • Doh!

    I forgot that I had switched out bundle identifiers for temporary testing on my device.

    You need to use the bundle identifier as specified in ITC.