Is there a way to call saveCurrentTurnWithMatchData without sending a push notification?

I have a game in the Game Center that allows players to make several moves per turn. In iOS 6, Apple implemented an excellent function in saveCurrentTurnWithMatchData strong> that allows you to do just that - it saves data in the game center to prevent cheating by re-moving again, for example, without moving to the next player.

The problem is that I found that this actually causes the same Push Notification that is sent when the player finishes his turn. Thus, other players in the game will see the icon on the application icon and mistakenly believe that this is their turn when it is not.

Has anyone found a workaround for this? Any way to call saveCurrentTurnWithMatchData strong> without sending a push notification? If not, this seems like a design flaw that should probably be brought to Apple.

+2
source share
1 answer

I agree, this seems like a design flaw. I am also developing a turn-based game in which a player can take several actions before transferring control to the next player. Meanwhile, I want other players to witness each action while they watch the game. If other players do not start the application, I want them to receive a push notification only when the control is transferred to another player.

Instead of using saveCurrentTurnWithMatchData: I use endTurnWithNextParticipants: but I am specifying the current player and not the next one. This seems like a trick:

 NSTimeInterval interval = 86400; // seconds in a day [currentMatch endTurnWithNextParticipants:[[NSArray alloc] initWithObjects:currentMatch.currentParticipant,nil] turnTimeout:interval matchData:[self packMatchData] completionHandler:^(NSError *error) { if (error) { // handle error } } ]; 
0
source

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


All Articles