Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I ensure my iPhone app uses the Game Center sandbox?

I'm developing an iPhone game with Game Center integration. The game is being built as Debug (not release/distribution). On the simulator, Game Center always uses the sandbox properly. On the iPhone device itself, it will go for a few days using the sandbox, then suddenly decide to use the real Game Center servers (which results in an error, because my game has not yet been released). It's been avoiding the sandbox for several days now, and I hate testing on the simulator. Any idea how to once and for all make it use the sandbox during development?

Here's the relevant quote from the Game Kit Programming Guide:

As a developer, your Game Center account may be logged into either Sandbox for testing, or into the live environment but not both. To change which account you are logged into, switch to the built-in Game Center app and log out, then run any Game Center enabled app. If that app is provisioned for development, enter your test account information to log into Sandbox. Otherwise, enter your live account information to log into the live environment.

As far as I can tell, my app is being provisioned using a Developer Provisioning Profile. The build mode is set to Debug. I have signed out of Game Center on the device. I also tried signing out of the Store for good measure.

like image 983
Jeremy Fuller Avatar asked Oct 13 '10 23:10

Jeremy Fuller


2 Answers

Deleting the app, logging out from Game Center app, and reinstalling the game from Xcode is what helped over here.

Previous version had no Game Center integration, and that version from App Store was installed on the device. Deleting it and installing again from Xcode apparently cleaned some stale cached information, and got the game to access Sandbox servers.

Also, I followed Apple's advice from the docs to use a separate test account, although I don't think that's what helped.

like image 72
Ivan Vučica Avatar answered Oct 02 '22 04:10

Ivan Vučica


The Game Center Programming Guide has a section describing when the sandbox environment is and isn't used (scroll down to "Testing a Game Center Application").

The table there gives the impression that developer builds always use Sandbox, but that's not quite been my experience. It has been my experience, however, that if I'm signed out of Game Center (using the Game Center app), when I run my app (device or not) that it prompts me to sign in to Sandbox. Which I guess is what the doc says, now that I'm re-reading it.

like image 20
zpasternack Avatar answered Oct 02 '22 05:10

zpasternack