GKTurnBasedMatch push notifications are very inconsistent
Asked Answered
O

3

7

I'm testing a turn based game between two devices. As far as I understand, sending a turn with [GKTurnBasedMatch endTurnWithNextParticipants:], for example, should automatically push a game center notification to the opponent. Sometimes, this works just as expected: the turn is sent and right away a banner notification shows up on the other device. All is well.

What is baffling me is that other times, even though the turn itself is sent properly (I can tell because when the opponent refreshes the matches, the match is up-to-date), there's no push notification coming in.

Are there any holes in my understanding here? If I'm understanding correctly, the inconsistent notifications shouldn't have anything to do with my code, because the issue here isn't how I handle notifications, it's that there is no notification at all. In other words, [handleTurnEventForMatch:] (aGKTurnBasedEventHandlerDelegate method) doesn't have anything to do with it (I don't think) because if no notification is being received, it's never going to be called anyway.

So, I'm just wondering if anyone has had any experience with this. Is it possible that this is due to something in my code? Or, is it possible that the Game Center sandbox is responsible for the inconsistencies, and there's nothing I can do about it?

Any thoughts or ideas would be much appreciated.

Orna answered 24/4, 2013 at 18:27 Comment(0)
O
2

For those who are experiencing similar problems: this turned out to be a Game Center sandbox problem. It had nothing to do with my code, and things were fine in the App Store release. So, read through the comments here and make sure there aren't other things factoring into whatever issues you're having...but know that it's possible that you're simply experiencing some Game Center sandbox issues that are out of your control!

Orna answered 6/12, 2013 at 17:16 Comment(3)
It is a 7 months old question you asked. Have you been experiencing it since then, or you started to experience it again these days? Because I suddenly started to experience it 3 days ago, while everything was working perfectly.Diageotropism
Still happening these days. Any reference to it never happening on production Game Center?Constellate
This is still happening for me. #34570904. Technically there's no longer a "sandbox" so, I don't really know that it's a sandbox issue.Led
K
4

It is an issue with GameCenter's sandbox mode. In order for your device to enter sandbox mode you have to open/run your app and authenticate game center. If you say, open a different (published) game after your game is open it will leave sandbox mode and and go back to regular game center mode.

Even if your game is running in the background, as long as it is the last game-center enabled game opened you should get the push notifications as normal. But if you open the game, and then kill the process, you will no longer be in sandbox mode and will not receive the push notifications.

Kwon answered 24/4, 2013 at 22:28 Comment(7)
I thought about this earlier, and it definitely accounts for some of what I originally thought was strange behaviour. However, I'm still noticing a whole bunch of inconsistencies despite completely signing out of regular game center and not using any other games. In fact, there are plenty of times where no notification is received even when the app is actively running. I've traded lots and lots of turns between my two devices and still can't see any rhyme or reason to it - sometimes both devices will be cooperating, sometimes only one, sometimes neither. Any other thoughts? Thanks!Orna
One thing I've noticed is that a notification always seems to get through on the first received turn after starting up the app from scratch (ie running from xcode or removing app from app tray and running it again). In other words, if I were to remove the app from the tray and start it up again after every turn I took on one device, it would (seemingly) receive a notification on each incoming turn. It seems to me like this would point to something about game center authentication, but all other communication with game center is working fine, so I'm still as confused as ever...Orna
You do not need to log out of game center. In fact, if you do log out then you will not receive the push notifications.Kwon
No no, I meant I logged out of my real game center account, to ensure that account wasn't crossing wires with my sandbox account. Of course the sandbox account needs to be active to receive the notifications I'm looking for.Orna
Game center invitations are not working this days, I dont know what´s going on with game center SandBox server. I hope that your issue it is coming becuase of that.I am having big problems with game center this 2 weeks, I am getting upsetCentrifugate
I also see this problem. I run no other apps at all between turns, and usually I leave the app running on both devices. With or without running in debug mode tethered to Xcode. iOS 6 or iOS 7. It does seem that the first turn after killing and restarting the app gets the push notification. At this point I'm seriously considering publishing the app as-is and testing in production.Anamorphism
Also, the app icon does not get the (1) badge, there's nothing in notification center, and the Game Center match starting dialog says "their turn" but when selecting the game and loading it's data it is my turn.Anamorphism
O
2

For those who are experiencing similar problems: this turned out to be a Game Center sandbox problem. It had nothing to do with my code, and things were fine in the App Store release. So, read through the comments here and make sure there aren't other things factoring into whatever issues you're having...but know that it's possible that you're simply experiencing some Game Center sandbox issues that are out of your control!

Orna answered 6/12, 2013 at 17:16 Comment(3)
It is a 7 months old question you asked. Have you been experiencing it since then, or you started to experience it again these days? Because I suddenly started to experience it 3 days ago, while everything was working perfectly.Diageotropism
Still happening these days. Any reference to it never happening on production Game Center?Constellate
This is still happening for me. #34570904. Technically there's no longer a "sandbox" so, I don't really know that it's a sandbox issue.Led
D
0

I am also facing the same problem. My game stops receiving turn events and turn notifications from Game Center, I finished my game and was testing, but this week, the problem started to happen. It was working like a charm but suddenly instances started not to receiving turn events for a couple of days.

I am using the iOS7 SDK and targeting iOS7 (turn event handling is different than prior iOS versions, I will need exchanges in upcoming game features, that's why I am using iOS7).

Then I made a test app to check if it was same with iOS6 and prior SDKs, but no help, it was same. So don't waste your time to upgrade your code to iOS7 hoping it would work, the problem is there. I also tried many things, like resetting devices and settings, using new users, etc.

I also tried it with Ray Wenderlich's Turn-Based Gaming with iOS 5 tutorial, by downloading source code, and it doesn't work neither.

The thing is, usually when I launch the game, game receives turn events, but after a few turns, it just stops, and when it stops receiving, stops like forever. If I reload the match, I can get the updated match and it's data is also updated, so I can make the turn. It means match is updated on Game Center. So, either Game Center is not pushing the data to users (possibly this is happening because user cannot receive notifications from Game Center when the game is in background), or the GameKit is not firing the event to the handler.

I don't know why it is happening, or why it started to happen, but I can't release my game like this, hoping that it would work out of sandbox. I will be trying a couple of more things (like maybe trying turn reminders of iOS7, to see if they push it to the user), then I will ask to Apple's support team. One other thing i am planning to do is, putting my test app to App Store and see it if works out of sandbox.

Hopefully it is a sandbox problem.

Diageotropism answered 7/12, 2013 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.