GKTurnBasedMatch push notifications are very inconsistent

I am testing a turn-based game between two devices. As I understand it, sending a turn using [GKTurnBasedMatch endTurnWithNextParticipants:] , for example, should automatically push the notification of the game center to the enemy. Sometimes this works as expected: the queue is sent, and a banner notification on the other device immediately appears. Things are good.

What puzzles me is that at another time, even if the turn itself was sent correctly (I can say that because when the opponent updates the matches, the match matches the last), there is no push notification in .

Are there any holes in my understanding? If I understand correctly, inconsistent notifications should not have anything to do with my code, because the problem here is not how I handle the notifications, but that there is no notification at all. In other words, the [handleTurnEventForMatch:] method (a GKTurnBasedEventHandlerDelegate ) has nothing to do with it (I don't think), because if a notification is not received, it will never be called.

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

Any thoughts or ideas would be greatly appreciated.

+6
source share
3 answers

For those facing similar issues: this turned out to be the Sandbox issue for Game Center. It had nothing to do with my code, and everything was fine in the release of the App Store. So, read the comments here and make sure that there are no other things that affect all your problems ... but be aware that it’s possible that you are just experiencing problems with the Game Center sandbox that you can’t do!

+1
source

This is a problem with the GameCenter game program. In order for your device to be in sandbox mode, you need to open / launch the application and verify the authenticity of the game center. If you say, open another (published) game after your game is open, it will leave the sandbox mode and return to the normal mode of the game center.

Even if your game is running in the background while the game is open in the last game with the game center, you should receive push notifications as usual. But if you open the game and then kill the process, you will no longer be in sandbox mode and will not receive push notifications.

+4
source

I am also facing the same problem. My game stops accepting turn events and turns notifications from the Game Center, I finished the game and tested, but this week the problem started. It worked like a charm, but suddenly the authorities began not to receive turnaround events for a couple of days.

I use the iOS7 SDK and configure iOS7 (event handling is different from previous versions of iOS, I will need exchanges in upcoming game functions, so I use iOS7).

Then I made a test application to check if it was the same with iOS6 and previous SDKs, but without help, it was the same. Therefore, do not waste time updating your code to iOS7, hoping that this will work, there is a problem. I also tried many things, such as rebooting devices and settings, using new users, etc.

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

The fact is that when I start the game, the game receives turn events, but after several turns it just stops, and when it stops receiving, it stops as always. If I restart the match, I can get an updated match, and it will also be updated, so I can make a move. This means that the match is being updated in Game Center. Thus, either Game Center does not push data to users (this may be because the user cannot receive notifications from Game Center when the game is in the background), or GameKit does not fire an event for the handler.

I don’t know why this is happening, or why it was starting to happen, but I can’t release my game like this, hoping it works out of the sandbox. I'll try a couple more things (for example, try turning iOS7 reminders to see if they click on the user), then I will ask the Apple support group. Another thing I plan to do is to put the test application on the App Store and see if it works from the sandbox.

Hope this is a sandbox issue.

0
source

Source: https://habr.com/ru/post/943567/


All Articles