Guest User

Untitled

a guest
Jan 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment