iOS Game Center invites not working at all in SANDBOX - ios

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.

Related

Adding Game Center turn-based multiplayer to an existing bundle id

I'm trying to add TBM to an app that already had a few versions released on the App Store (including game center leaderboards).
To get started, I first created a new test app on itunes connect and implemented all the basic methods I would need; everything was working smoothly.
I then proceeded to integrate the framework on my live app. It sort of works, but it has a few issues. The most obvious ones:
receivedTurnEventForMatch never fires
Game Center notifications are never received
Long story short: I went back to my test project, replaced the bundle id with the one from the live app, and this way it has exactly the same issues.
Of course, Game Center is enabled on this app and leaderboards are working as expected.
Any idea on what might be the issue? Is there any particular care to take when extending GC functionality to an existing app?

What to do to make sure admob is ready to go to production?

I'm integrated admob with my ios game and everything works great.
I can't find a "switch" option from test to production just like I have in other ad networks (vungle for example).
I can find zero information how to prepare it to be published (maybe it is too obvious?).
That makes me very uncomfortable, because I want to make sure the ads will be real ones and I will get paid for that.
for example, should I remove my device id from request testing property?
should I not worried because admob is smart enough to figure out if it is production or testing?
please help
The ads are already live. They provide the test devices dictionary so that it can detect its a test ad. If you ran the app on a device which isnt in the test devices dictionary, you will receive live ads. Obviously AdMob will block your service if you purposefully make real requests from development.
I accidentally ran an app on a device that wasnt in the test devices and I got a real advert. I'm sure it happens often so they probably excuse a certain amount of accidental real requests.
for example, should I remove my device id from request testing property?
Yes, you should remove your Test ID in your distribution release. Only use the Ad Unit ID given to you by AdMob to request ads in your distribution release.
I can't find a "switch" option from test to production just like I have in other ad networks (vungle for example).
There is no switch for you to turn on when you plan to build your application for distribution. If you're successfully receiving test ads on your device then you've implemented the advertisements correctly.
That makes me very uncomfortable, because I want to make sure the ads will be real ones and I will get paid for that.
You can receive live ads before the release of your application in the App Store by removing your Test ID and running your application on a real device.

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.

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 on iPad simulator not working

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

Resources