4
votes

I'm making a turn-based game, using the Game Center Turn-Based Gaming functionality. I'm using the simulator and my iPhone to test notifications of turn events. The results are very inconsistent. About 75% of the time when I make a move on the simulator and pass the turn I don't get any notifications on my iPhone. It seems that this function doesn't get called:

handleTurnEventForMatch:didBecomeActive:

I set the GKEventHandlerDelegate in the code that authenticates the local user and it seems to be set correctly. The fact that I get notifications once in a while suggests that this isn't where the problem lies.

Does anyone have any idea what could be the problem here? Could this be a problem with the Sandbox Game Center Server? Do they limit the amount of notifications you can send in a short amount of time or something like that?

Edit: I just found some posts of people experiencing the same problem, but no solution. No very recent posts though. Any updates?

Edit2: I also find that after a move, when I open the GKTurnBasedMatchmakerViewController on the other device it still says that it's the turn of the other player. When I close and reopen it the information is correct. Also, when I open the game GKTurnBasedMatchmakerViewController when it's still showing incorrect information, it does gives me the correct match object with the updated information. Could this be related in any way?

2
I am getting exactly the same sort of thing. It is very frustrating. I'm going to hope that the live version of the game center is as crappy as the sandbox. Also... I'm using the newer iOS 7 [[GKLocalPlayer localPlayer] registerListener:]; - AutomatonTec
I hope you mean "isn't as crappy" :p - Bart
I just switched to the [[GKLocalPlayer localPlayer] registerListener] as well. We still need to add the old one if we want to support iOS 6 right? - Bart
Nope. It's still unclear what's causing this, but the consensus seems to be that it's a problem with the Sandbox server and that it shouldn't occur in production. But nobody seems sure. - Bart
I am also experiencing this issue with code that has been working flawlessly for over 6 months. I think it is a sandbox issue. Something of note is that if I go into the Game Center app and view my turns (the last item on the tab bar on the bottom) it will refresh my matches properly and show the turns taken. Then, if I go into my game and reload the matches, the information is correct. Obviously this is an issue on Apple's side, but using this trick I have been able to (sort of) continue testing my code. NOTE: I use custom UI for showing and creating matches, not the default view controller. - Corbin87

2 Answers

1
votes

I thought I would share my solution with you, in the hopes that it is the same problem you are experiencing. As you can see from my comment to your question, I was having the same issue as you. It turned out that my settings in iTunes Connect were the culprit, unbeknownst to me. What you should check for is that you still have Game Center enabled in BOTH places that iTunes Connect requires. First, after going into "Manage my Apps" in iTunes Connect, select your app and on the right menu, and click "Manage Game Center". Make sure this is currently enabled. I would even recommend disabling it, and re-enabling it again for good measure.

In addition (and this is what I was missing), you must enable it in one more place. Go back to the previous screen when you first select the app. The top right is where you can select Manage Game Center, but we are looking on the bottom in the "Versions" section. Click the View Details button for your app, and make sure the Game Center button is enabled near the bottom. Again, I would disable and re-enable it here as well. Give it about 10 minutes, clear all your open turns and matches from the Game Center app (this might be an optional step), and build & run again. Hopefully, you will receive turn notifications properly again.

0
votes

I got the same problem. However when i tested it on multiple devices it was working fine... May be some problem with the simulator