daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
  2.  
  3.  localPlayer.authenticateHandler = ^(UIViewController *loginVC, NSError *error) {
  4.     if ([GKLocalPlayer localPlayer].authenticated) {
  5.         // authentication successful  
  6.     }
  7.     else if (loginVC) {
  8.         // player not logged in yet, present the vc
  9.         [self presentViewController:loginVC animated:YES completion:nil];
  10.     }
  11.     else {
  12.         // authentication failed
  13.     }
  14. };
  15.    
  16. GKScore *score = [[GKScore alloc] init];
  17. if (score) {
  18.     score.value = self->selectedScore;
  19.     NSArray* scoreArray = [[NSArray alloc]initWithObjects:score, nil];
  20.     //score.category = @"High Scores";
  21.  
  22.     UIActivityViewController *avc = [[UIActivityViewController alloc]
  23.                                      initWithActivityItems:scoreArray applicationActivities:nil];
  24.     avc.completionHandler = ^(NSString *activityType, BOOL completed) {
  25.         if (completed)
  26.             [self dismissViewControllerAnimated:YES completion:nil];
  27.     };
  28.  
  29.     if (avc)
  30.         [self presentViewController:avc animated:YES completion:nil];
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top