有没有办法在不发送推送通知的情况下调用 saveCurrentTurnWithMatchData? [英] Is there any way to call saveCurrentTurnWithMatchData without sending a push notification?

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

问题描述

我有一个 Game Center 游戏,允许玩家每回合进行多次移动.在 iOS 6 中,Apple 在 saveCurrentTurnWithMatchData 中实现了一个很棒的功能,它允许您做到这一点 - 它将数据保存到游戏中心,以防止通过重复重做动作来防止作弊,例如,无需前进到下一个玩家.

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.

问题是,我发现这实际上触发了当玩家确实结束他们的回合时发送的相同推送通知.因此,游戏中的其他玩家会在应用图标上看到一个徽章,并错误地认为该轮到他们了,而实际上没有.

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?如果没有,这似乎是一个设计缺陷,应该引起 Apple 的注意.

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆