0

So my problem is that after integrating gamecenter nicely into my iphone app, it won't show the achievements list!

The integration was a success I think because when I use the submitAchievement method, I do unlock achievements on the list. But I must look at the list from the GameCenter App on the iPhone, not within my own app as it doesn't work. ikuragames first help me get the code right (thx you !!) but it still doesn't work ! :(

-(void)showAchievments
{
    //NSLog(@"showAchievments");
    GKAchievementViewController *achievements = [GKAchievementViewController alloc] init];
    if (achievements != nil)
    {
        achievements.achievementDelegate = self;
        [(EAGLView *)self.view achievmentsWillAppear];
        [self presentModalViewController:achievements animated:YES];
    }
}

- (void)achievementViewControllerDidFinish:(GKAchievementViewController *)viewController
{
    //NSLog(@"achievementViewControllerDidFinish");
    [glView achievmentsWillDisappear];
    [self dismissModalViewControllerAnimated:YES];
}

On debug mode, I can clearly see that each line or code are "processed" and not error whatsoever is displayed. BUT, nothing appears on my screen :(

Can you please help me ? (here is some doc.)

  • Are you logged into a sandbox GameCenter account? – jonmorgan Feb 24 '12 at 14:07
  • I don't know, how can I check that? I just checked on iTunes Connect and it says : "Game Center has been enabled for your app" and I got like ids and stuff for it. Acheivements have already been added so I can test unlocking them – user1158125 Feb 24 '12 at 14:22
  • After checking, I got a sandbox account. But that shouldn't be a problem right ? – user1158125 Feb 24 '12 at 14:52

1 Answers1

0

I found the answer.

Turned out that the view controller I was sending showAchievments to was not the view controller I wanted.

I was doing something like:

[[myViewController sharedInstance] showAchievments];

But the sharedInstance method returned a brand-new, vanilla-initialised myViewController, and not the one I was already using.

Now it works perfectly, I hope this will help someone in the future.

Costique
  • 23,712
  • 4
  • 76
  • 79