Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
- localPlayer.authenticateHandler = ^(UIViewController *loginVC, NSError *error) {
- if ([GKLocalPlayer localPlayer].authenticated) {
- // authentication successful
- }
- else if (loginVC) {
- // player not logged in yet, present the vc
- [self presentViewController:loginVC animated:YES completion:nil];
- }
- else {
- // authentication failed
- }
- };
- GKScore *score = [[GKScore alloc] init];
- if (score) {
- score.value = self->selectedScore;
- NSArray* scoreArray = [[NSArray alloc]initWithObjects:score, nil];
- //score.category = @"High Scores";
- UIActivityViewController *avc = [[UIActivityViewController alloc]
- initWithActivityItems:scoreArray applicationActivities:nil];
- avc.completionHandler = ^(NSString *activityType, BOOL completed) {
- if (completed)
- [self dismissViewControllerAnimated:YES completion:nil];
- };
- if (avc)
- [self presentViewController:avc animated:YES completion:nil];
- }
Add Comment
Please, Sign In to add comment