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

6

11

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.

Popularize answered 13/10, 2010 at 23:46 Comment(3)
I'd imagine that it's the provisioning profile that the app gets signed with...Couldst
How would that affect it? The provisioning profile is just a list of acceptable devices, and a bundle ID. Am I missing something obvious here?Popularize
I have tried all the solutions listed in the answers, but am having the very same problem. Very strange.Uninspired
P
2

I restored my iPhone from a backup. This had the effect of removing all provisioning profiles and the game itself. I then used Xcode to install and run the game, and sandbox magically started working again. I'm not sure if the full restore was required, or just removing the game. I had previously tried removing all provisioning profiles, and that didn't work. I suspect the restore was likely necessary in my case.

Edit: It might be my imagination, but iOS 4.2 seems to have improved the stability of the sandbox somewhat. I've noticed that the device seems to log me in to the sandbox even on other release games on my device (games by other companies). It seems to permanently keep me in sandbox mode until I sign out. I haven't done any more experimentation to test this in 4.2 since I am loathe to restore my device again if it stops working.

Popularize answered 16/10, 2010 at 18:23 Comment(0)
M
4

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.

Mcatee answered 9/2, 2011 at 13:1 Comment(0)
I
2

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.

Insignificance answered 14/10, 2010 at 6:0 Comment(1)
I'm definitely signed out of Game Center using the Game Center app. I've read the documentation repeatedly, looking for clues, and haven't been able to solve it.Popularize
P
2

I restored my iPhone from a backup. This had the effect of removing all provisioning profiles and the game itself. I then used Xcode to install and run the game, and sandbox magically started working again. I'm not sure if the full restore was required, or just removing the game. I had previously tried removing all provisioning profiles, and that didn't work. I suspect the restore was likely necessary in my case.

Edit: It might be my imagination, but iOS 4.2 seems to have improved the stability of the sandbox somewhat. I've noticed that the device seems to log me in to the sandbox even on other release games on my device (games by other companies). It seems to permanently keep me in sandbox mode until I sign out. I haven't done any more experimentation to test this in 4.2 since I am loathe to restore my device again if it stops working.

Popularize answered 16/10, 2010 at 18:23 Comment(0)
G
2

Just had a quick note to add: after resetting my iPhone Simulator I thought it hadn't made any difference, as the login dialog didn't include the "***SANDBOX***" string (though my build of the GKTapper sample did). When I went to create an account anyway, it confirmed that I was connected to the sandbox.

Gelinas answered 6/12, 2010 at 4:55 Comment(0)
G
2

I was having the same issue: Sandbox Game Center working on some devices, others showed the dreaded "this game is not recognized by game center" message. The logout from game center -> delete app -> reinstall from Xcode solution did the trick. Thanks to everyone for their suggestions.

Gretta answered 30/3, 2012 at 7:39 Comment(0)
B
0

From iOS 8 SandBox must be manual set on your phone. You must mark in Settings -> Game Center -> and switch ON Sandbox else it won't work and with debug certificates, Game Center login won't succeed.

enter image description here

Blemish answered 20/8, 2015 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.