objective c - How to implement Game Center Leaderboards in iOS 7? -


i creating game ios 7 , trying implement game center leaderboards. got app open leaderboard when click button, says "no items". not sure right if problem submitting scores or retrieving leaderboards. appears problem submitting score because says app name on top of leaderboard, can't find error. code submit score:

-(void)reportscore:(nsinteger ) highscore {     if ([gklocalplayer localplayer].isauthenticated) {         gkscore *scorereporter = [[gkscore alloc]  initwithleaderboardidentifier:@"flapjacks1" forplayer:[gklocalplayer localplayer].playerid];     scorereporter.value = highscore;         nslog(@"score reporter value: %@", scorereporter);     [gkscore reportscores:@[scorereporter] withcompletionhandler:^(nserror *error) {         if (error != nil) {             nslog(@"error");          // handle reporting error          }      }];     } } 

this method retrieving leaderboard:

-(void)displayleaderboard { //nsstring *_leaderboardidentifier = @"flapjacks1"; [[gklocalplayer localplayer] loaddefaultleaderboardidentifierwithcompletionhandler:^(nsstring *leaderboardidentifier, nserror *error) {      if (error != nil) {         nslog(@"%@", [error localizeddescription]);     }     else{         //_leaderboardidentifier = leaderboardidentifier;         gkgamecenterviewcontroller *gamecentercontroller = [[gkgamecenterviewcontroller alloc] init];         if (gamecentercontroller != nil)         {             gamecentercontroller.gamecenterdelegate = self;             gamecentercontroller.viewstate = gkgamecenterviewcontrollerstateleaderboards;             //gamecentercontroller.leaderboardtimescope = gkleaderboardtimescopetoday;             gamecentercontroller.leaderboardidentifier = @"flapjacks1";             [self presentviewcontroller: gamecentercontroller animated: yes completion:nil];         }     }  }];  } 

so, i'm not sure if improperly accessing leaderboard or if leaderboard has no data. have been searching on , can't find answer. appreciated.

have added leaderboard information application in itunes connect , submitted application status waiting binary upload? may need wait 24 hours after setting application status, before can use sandbox version of new leaderboards.

you need make sure enable game center components (leaderboards , achievements) version of application submitting, separate area create leaderboards in itunes connect.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -