来调用saveCurrentTurnWithMatchData不

来调用saveCurrentTurnWithMatchData不

本文介绍了有什么办法来调用saveCurrentTurnWithMatchData不发送推送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个游戏中心的游戏,让玩家做每回合多运动。在iOS 6中,苹果在实现一个很大的特点 saveCurrentTurnWithMatchData ,允许你只是做它但─反复重做例如此举将数据保存到游戏中心,以prevent作弊,没有推进到下一个玩家。

I have a Game Center game that allows players to make multiple moves per turn. In iOS 6, Apple implemented a great feature in saveCurrentTurnWithMatchData that allows you to do just that- it saves the data to game center to prevent cheating by repeatedly redoing a move for instance, without advancing to the next player.

问题是,我发现,这实际上触发了同一个推送通知taht当玩家的确实的结束轮到自己被发送。所以在游戏中的其他玩家将看到应用程序图标徽章,并误以为轮到他们时,它不是。

The problem is, I have discovered that this actually triggers the same Push Notification taht gets sent when the player does end their turn. So other players in the game will see a badge on the app's icon and mistakenly think it's their turn when it isn't.

有没有人找到这个解决方法?任何方法来调用 saveCurrentTurnWithMatchData ,而不发送推送通知?如果没有,这似乎是一个设计缺陷,也许应该把苹果的关注。

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

推荐答案

我同意,这似乎是一个设计缺陷。我也在开发的回合制游戏,由此玩家可以通过控制权交给下一个玩家之前采取若干行动。同时,我希望其他球员,而他们是在看比赛见证每一个动作。如果其他球员没有运行应用程序,我想他们接受只有当控制传递给其他玩家一个推送通知。

I agree, this seems like a design flaw. I am also developing a turn-based game whereby a player can take several actions before passing control over to the next player. Meanwhile, I want other players to witness every action while they are looking at the game. If the other players are not running the app, I want them to receive a push notification only when the control is passed to another player.

而不是使用 saveCurrentTurnWithMatchData的:,我用 endTurnWithNextParticipants:,但我指定的当前玩家,而不是下。这似乎这样的伎俩:

Instead of using saveCurrentTurnWithMatchData:, I use endTurnWithNextParticipants: but I specify the current player rather than the next. This seems to do the 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
    }
  }
];

这篇关于有什么办法来调用saveCurrentTurnWithMatchData不发送推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 17:59