GameCenter login alert

后端 未结 7 1338
无人共我
无人共我 2021-02-02 01:59

In a game I am developing using GameCenter, I want to handle the following scenario:

  1. the user starts up the game. He is shown the system alert that prompts him to
7条回答
  •  无人及你
    2021-02-02 02:22

    I couldn't find a good answer for this either, so I decided to just replicate the message once the I start getting the cancel error. This is still in development but it basically changes the button callback to display the error alert rather than display the leader-board.

    Just a note, not sure if this will be approved or not since I am replicating an Apple error message.

    -(void) gcLogin: (id) sender {
        [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
            if(error) {
                if([[error domain] isEqualToString:GKErrorDomain] && [error code] == GKErrorCancelled) {
                    [ResourceManager showAlertWithTitle:@"GameCenter Disabled" message:@"Sign in with Game Center application to enable"];
                    mGameCenterCancelled = YES;
                }
                NSLog(@"%@", [error description]);
            } else { 
                [self updateMenu];
                mGameCenterCancelled = NO;
            }
        }];
    }
    

提交回复
热议问题