IOS Game Center on iPad simulator not working - ipad

I believe this question has been asked before but the solution(s) offered were not relevant or applicable to me.
I am halfway through coding a game app and have just added basic Game Center functionality to my app - it just checks if the user is signed into the Game Center upon startup. If not, it should show a pop-up box prompting the user to either sign in or cancel. When I ran the app in my iPad simulator, I realised it was not doing anything. When I tried running the Game Center app itself in my iPad simulator, I realised that I could not sign in with my usual iTunesconnect account - it just kept hanging. When I tried to "Create new account", it said "Game Center account services are currently unavailable". However I am able to use the Safari app in the simulator to access the web.
I have an iPad at home which is connected to the internet via the same router (so it cannot be a firewall config problem) which is always on Game Center. When I got the error message on my simulator, I checked the connection on my iPad and I was still logged into the Game Center. When I tried signing out, I could sign in again immediately without any problems. So I tried testing my app in my iPad instead - I got xCode to build the app in my iPad. When I ran the app, it popped up the pop-up box, saying it was using a Sandbox account, and prompted me to sign in with my itunesConnnect account so I did so, but nothing else happened - however I had not programmed any further Game Center functionality into the app. When I quit my app and tried running the Game Center app from my iPad, it started behaving like the iPad simulator -- it would hang when I tried to sign in with my iTunesconnect account, and when I tried to create a new account instead, it would tell me that the services were currently unavailable... when barely 10 mins before, before I installed and ran my app, everything was working OK.
Could I have hosed some settings in my iPad Game Center and now it won't work?? I do not understand how installing my app could have affected the Game Center app in any way. Now both my iPad device and my simulator will not sign into Game Center.
PS: I have checked my /etc/hosts file etc. on my computer and it is the default file, it cannot be a problem with my firewall because I was always able to access Game Center on my iPad before this. Does anyone have any ideas? This is driving me crazy and I wonder if I have to resort to clicking "Restore" on my Ipad to bring the Game Center back. But it still won't solve the problem with the simulator on my Mac not working.
Thank you for any suggestions!!!!
Artie

I've struggled with exactly the same symptoms over the past few days. In the end, I had to disable my firewall (running on a 3com ADSL OfficeConnect), then the sandbox mode works. Interesting notes:
Like you, I was just attempting to set up GC authentication to a sandbox account at this point.
I can access the non-sandbox GameCenter servers with the firewall running on high. Access to normal GameCenter doesn't imply it isn't a firewall problem.
This is a common hardware router/firewall, and I wasn't blocking any particular ports.
This is repeatable -- toggling the firewall on and off prevents/allows access to the GC sandbox servers.
[Speculative: the firewall's logging is pretty useless, but it reports a (non-existent) TCP FIN scan -- the "high" settings may be a bit sensitive. Doesn't make much sense that this would only affect access to the sandbox servers, but empirically, it does.]

In order to use Game Center on a test app you have to set up development Game Center (sandbox) accounts specific to your app and use those to log in and test game center features.
You can read the Game Kit Programming Guide: Game Center Overview to make sure you have everything setup correctly on the Apple server side before adding game center code to your app.

Close your app and any other Game Center apps. go to Settings->Game Center - click on your connection name and select Sign out. Next run a game Center app that you did not write (EX angry birds) logon into to game center (tara) you are no longer in sandbox

Related

iOS Simulator not giving me sandbox option for Game Center

I'm making an iPhone SpriteKit-based game, and I just added all the code for game center, but when I try to run it I get a pop-up window that says, "Game Center unavailable, player is not signed in". So I was looking through the game center programming guide and it says that I am supposed to enable the sandbox option, but when I go into Settings then Game Center, there is no option to enable the sandbox. I only get an option for logging. I was wondering how I can enable sandbox in Game Center so I can hopefully solve this issue.
Have you viewed this link?
You may need to sign out of your GameCenter account before you can do this.
When I signed into Gamecenter, signed out, signed back in then switched to myapp I see "Welcome back sandbox". It looks like Sandbox is automatic in the simulator.

iOS: how to create multiple test users in sandbox environment having only 1 device available?

I would like to create multiple test users for testing my App in a sandbox environment. Unfortunately I got only one device (iPod touch) from where I created a test user.
On the simulater it doesn't seem to be able to connect to GameCenter and hence I do not know how to create another users without having another device.
I need to do so because the leaderboard won't show scores unless there are 2 or more users.
The simulator can connect to the Game Center. (The thing it can't do is make in-app purchases.) If you're testing your app in the sandbox you have to log into the Game Center within your app, not in the Game Center app. If you are already logged into Game Center with a normal login run the Game Center app on the simulator and log out. Then run your app and log in within your app.

Adding Game Center Support on iTunesConnect Broke My In App Purchasing

I had a well functioning in app purchase system in place and everything was going great. However, after managing Game Center and adding some leaderboards/achievements here on iTunes Connect (without changing anything in the code), in app purchase stopped working altogether and keeps giving me "Unable to Connect" errors. Could this have somehow messed up the sandbox environment? Anyone know what could be the problem?
I think there is a definite correlation since enabling/disabling Game Center on iTunesConnect changes behaviour on the device, but even if I disable everything it tsill won't go back to the way it was before).
I've been at this for days now. Help?
I doubt there's any correlation between Game Center and IAP, although the sandboxes are pretty unreliable. Have you checked so that your Paid Applications contract hasn't expired or is invalid in some other way? Also, have you checked that your test user is still valid?

Sandbox GameCenter accounts failing to find each other in matchmaking

I'm developing a turn-based iPhone game using Game Center. I created two Game Center accounts for testing but neither can find the other when I try to matchmake games. Both are in two matchmade games alone - neither found the other when matchmaking, in spite of the fact that the matches have 8 players max. What do you think could be causing this? Should I just put it on my physical device, because the games don't really work in sandbox, or what?
Gamecenter testing was a big disappointment for me, but I would enjoy to summarize some things that I learned in the process.
Make sure
-You enabled gamecenter support in both itunes connect's app information section and inside version details
-You completed a turn with a call to endTurnWithMatchData otherwise no other user will be able to connect to your game
-Know that simulator is able to connect to a game but it can't receive data only actual devices can.
-It is not a lag!
There is the possibility that your devices are actually able to match but there is a huge lag before they can, so you think it is not working. This happens to me with my iPad and iPhone for testing, it always takes around a minute to match another device. I have a asked a question regarding this lag here :Game Center Matchmaking GKTurnBasedMatch has significant lag (~1 min) Most replies told same things happens to them and problem is usually in apple's server not your code. I have also contacted apple for the issue by submitting a TSI, they have suggested doing many things (such as trying different gamecenter sandbox accounts, turning off the device, hard reset) but in the end all they told me was 1 min is well within the acceptable lag for turn based matchmaking. I have also submitted a bug report with ID #: 13635249 and its status is open.

iOS Game Center invites not working at all in SANDBOX

I´m trying to develop a multiplayer App & I´m using GKMatchmaker for that.
Unfortunately its .inviteHandler is never fired, it just says "failed" in the game center invite dialogue. The app works with AUTO-MATCH though.
I did some testing & made sure that
2 seperate sandbox gamecenter accounts are logged in.
the test app runs on 2 devices (1 iPhone 4S & 1 iPad 2)
They still don´t connect.
I tried to start DOODLE JUMP (an existing iOS Game) und use the sandbox accounts for multiplay... they did not work either. Then i logged in with my REAL NON SANDBOX accounts to game center & THERE Doodlejump was working and the invitation was received successfully.
Do you have any ideas, how I could make my sandbox account work & receive my game center invitations?
Hope this still would be useful for someone...
Check two things in such situation:
You set inviteHandler just after the local player has authenticated.
The player you're trying to invite did allow game invites in their account settings. In case you had two test accounts, you could forget you disallowed it for both of them. In such case the push notification for invite won't even be sent to the other player.
As stated in the Apple GameKit Programming Guide, a signed distribution build app will use the live GC environment, while everything else will use the sandbox. Unless you have the Doodle Jump source and build a debug version to run on your devices it will not work in sandbox mode properly.
Also you should make sure you are calling your inviteHandler method as soon after you authenticated a user as possible.
If the above don't work, try restarting your devices. I created two test accounts and logged into two different devices with each respective account. I couldn't get invitations to work, though automatching was working fine. Restarting the devices somehow 'registered' them to get push notifications from Game Center, and invitations suddenly started working.

Resources