Anyone able to get the GameCenter module to work?

Monkey Targets Forums/iOS/Anyone able to get the GameCenter module to work?

benmc(Posted 2013) [#1]
I'm trying to implement the new GameCenter module, but so far, GameCenter never starts on the device. I'm not getting any errors, warnings, etc, it just never loads. Wondering if anyone else has gotten it to work and ran into any gotchas that may be what I'm missing?

I have GameCenter setup for the app with a leaderboard in iTunes Connect.

I use the same bundle ID.

Are there any special Frameworks I need to import for it to work in XCode maybe?


benmc(Posted 2013) [#2]
Think I'm finding the problem to be related to the fact that to login to game center you have to have Portrait orientation enabled.

But, for a landscape game, you don't want to rotate that way, so I had to modify the main.mm again to override what was happening (I think).

Basically, for supportedInterfaceOrientations I just return:

return UIInterfaceOrientationMaskAllButUpsidedown;

Then I removed the shouldAutorotateToInterfaceOrientation function and put in my own:

-(BOOL)shouldAutorotate {
return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait;
}

And this seems to be working so far.


ElectricBoogaloo(Posted 2013) [#3]
What?
Don't be silly!
The thing works fine..

*logs out of GameCenter*
*runs game*

OMFG My Game Crashes!!!! OMG!WTF!WTF!OMG!WTF!WTF!BBQ!WTF!?!?!??

Um.. Over 2500 people have played it so far, and nobody's mentioned it, so I'm just going to assume that nobody else has noticed this yet. tum-tee-tum, tra-la-laaa!!

Already waiting for update #1 to get through AppleReview, so will wait for that to pass before fiddling some more.
Stupid GameCenter, always breaking things.
grr..

(*but very nice of Mark to have taken the time to tackle it as well as he has)


benmc(Posted 2013) [#4]
My guess is the problem is probably something to do with running in landscape mode and if you had disabled Portrait mode in XCode, then the game crashes whenever it tries to go to the Game Center login screen.

My fix above seems to be working fine for my game so far.