So I’ve been experimenting on Unity3.5’s Social API to do iOS game center stuffs. I enabled game center for my app through itunesconnect already and did some test on sandbox authentication using Social.localUser.Authenticate() via the SIMULATOR, and it works fine, note that I can get it working just on THE SIMULATOR.
However, when I deployed the same app to the REAL DEVICE, I can’t get my phone to enter the SANDBOX environment. On the real device, whenever I call “Social.localUser.Authenticate()”, it always prompt a REAL game center login. (Sandbox would have “Sandbox” labeled on the prompt login) which make me unable to test it.
Does anyone know how to solve this?
It’s probably because you have logged in to Game Center on the device. From the Unity GameCenter docs:
You can only log on to the sandbox through a development application, make sure you are not logged into GameCenter using the GameCenter app before testing begins. You should see ** Sandbox ** in the login dialog, if you don’t see this then you are logging on to the real one. Sometime it happens that the OS forgets that the application is using the sandbox and you will be logged on to the real one. If the application has not be submitted to Apple already then this will probably result in an error. To fix this all that needs to be done is to delete the app and redeploy with Xcode. To make another apple ID a friend of a sandbox user it needs to be a sandbox user as well.