★ TouchArcade needs your help. Click here to support us on Patreon.

Game center integration problem

01-25-2011, 10:26 AM
#1
Junior Member [Original Poster]
Joined: Jul 2010
Posts: 7
Game center integration problem

Hi guys,

I'm trying to implement Game Center in my game but met a little problem.
I made a game center menu in my game with 2 buttons for the leader board and achievements. I'm trying to open the respective game center tabs when you hit those buttons the same way Openfeint does it but haven't been successful so far.
I can load the tabs but always get redirected to a debug menu when trying to leave the tabs and go back to my menu.

Did anyone encountered the same problem?
Or someone has the time to give me a link with a step by step procedure?

Thanks a lot.

Last edited by Sirke; 01-25-2011 at 10:29 AM.
01-25-2011, 11:39 AM
#2
Joined: Nov 2010
Posts: 274
Quote:
Originally Posted by Sirke View Post
Hi guys,

I'm trying to implement Game Center in my game but met a little problem.
I made a game center menu in my game with 2 buttons for the leader board and achievements. I'm trying to open the respective game center tabs when you hit those buttons the same way Openfeint does it but haven't been successful so far.
I can load the tabs but always get redirected to a debug menu when trying to leave the tabs and go back to my menu.

Did anyone encountered the same problem?
Or someone has the time to give me a link with a step by step procedure?

Thanks a lot.
Wasn't there an open source Game Center implementation of like a pong game in this very forum? I'd start with that.
01-25-2011, 12:16 PM
#3
Joined: Aug 2009
Posts: 618
Quote:
Originally Posted by Sirke View Post
I can load the tabs but always get redirected to a debug menu when trying to leave the tabs and go back to my menu.
I am looking deep... deep into my crystal ball... deeeeepppp....

I see in my mind's eye that you forgot to implement the Delegate Selectors... You'll need these in your class:

Code:
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
    [self dismissModalViewControllerAnimated: YES];
    [viewController release];
}

- (void)achievementViewControllerDidFinish:(GKAchievementViewController *)viewController;
{
    [self dismissModalViewControllerAnimated: YES];
    [viewController release];
}
You'll need to implement the delegate interfaces in the header for the class:

Code:
@interface MyClass : GKLeaderboardViewControllerDelegate, GKAchievementViewControllerDelegate>
Then you'll need to make sure you set the delegate class when you launch the UIs:

Code:
   GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
    if (leaderboardController != NULL) 
    {
        leaderboardController.category = self.currentLeaderBoard;
        leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
        leaderboardController.leaderboardDelegate = self; // MAKE SURE YOU HAVE THIS!
        [self presentModalViewController: leaderboardController animated: YES];
    }
My spherical hunk of glass seems to think that will fix you up.

What do you get when you cross Robotron with Bomberman? - Coverfire HD
01-25-2011, 10:22 PM
#4
Junior Member [Original Poster]
Joined: Jul 2010
Posts: 7
Thanks to you both for the answers! I will check right away.
My programming skills have been buried for almost a decade so please excuse my poor soul :-)

@thewiirocks: I surely need one of those crystal ball myself. It would make my life a lot easier and not only for the code part
01-25-2011, 10:32 PM
#5
Joined: Aug 2009
Posts: 618
Quote:
Originally Posted by Sirke View Post
@thewiirocks: I surely need one of those crystal ball myself. It would make my life a lot easier and not only for the code part
You're absolutely right. My bowling scores have never been better!

What do you get when you cross Robotron with Bomberman? - Coverfire HD
02-16-2011, 03:28 PM
#6
Joined: Jun 2010
Location: Europe
Posts: 334
Send a message via Skype™ to vklymenko
hi, can you help me with my integrations : )

- I tried to have GameCenter.mm and GameCenter.h with all functions and delegate - but how to call functions from other .m files? for example I have main app delegate class and function on_app_did_finish_load and need to call a function like ShowLeaderboard etc from here?

- is that possible to have all GC functions in main app delegate instead separate GameCenter.mm and GameCenter.h files ? but then I have "self is undeclared" issues and can't close leaderboard view and assign delegate

plz help me, it will be paid help:
http://www.stonetrip.com/developer/f...p=29700#p29700