如何获得GameKit基于回合的比赛的通知? [英] How do I get notifications for GameKit Turn-Based matches?

查看:98
本文介绍了如何获得GameKit基于回合的比赛的通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于回合的iOS5 API的基于回合的iOS游戏。

I'm working on a turn based iOS game using the new turn-based iOS5 API.

您需要实现的代理协议之一是GKTurnBasedEventHandlerDelegate。实现的方法之一是handleTurnEventForMatch。这是来自Apple文档的此方法:

One of the delegate protocols you need to implement for this is GKTurnBasedEventHandlerDelegate. One of the methods to implement is handleTurnEventForMatch. This is from the Apple docs on this method:

handleTurnEventForMatch


当本地玩家轮到以
回合为基础的比赛时,向代表发送

Sent to the delegate when it is the local player’s turn to act in a turn-based match.



- (void)handleTurnEventForMatch:(GKTurnBasedMatch *)match

参数


match - 包含匹配当前状态的匹配对象。

match - A match object containing the current state of the match.

讨论


<收到此消息,播放器已接受对已经在进行中的比赛的
推送通知。你的游戏应该
结束任何它正在执行的任务,并切换到比赛对象提供的匹配
信息。

When your delegate receives this message, the player has accepted a push notification for a match already in progress. Your game should end whatever task it was performing and switch to the match information provided by the match object.

我的游戏大部分都在工作。我收到通过上述方法收到的移动通知。
我也看到应用程序图标上的徽章更新成功。

Most of my game is working. I'm getting notifications of moves received via the above method. I'm also seeing badges on the app icons being updated successfully.

但是,我没有得到任何其他系统通知,没有显示在通知中心等等。我需要做一些外部的GameKit启用这个?当我得到handleTurnEventForMatch时,我需要手动发送本地通知吗?文档似乎并不意味着,因为它在上面说当你的代理接收到这个消息,播放器已经接受了一个推送通知的匹配已经在进行中。

However, I am not getting any other system notifications when turn events come in; nothing shows up in the notification center, etc. Do I need to do something outside of GameKit to enable this? Do I need to manually send a local notification when I get handleTurnEventForMatch? The docs seem to imply not since it says above "When your delegate receives this message, the player has accepted a push notification for a match already in progress."

似乎暗示玩家已经点击推送通知以获得此方法(但是当然他们从不出现,所以我没有!)

So this seems to imply that the player has clicked on a push notification to get this method called (but of course they never appear, so I have not!)

我需要什么在我的应用程序启用推送通知基于回合的事件?当我收到上述方法时,我需要实际发送一个本地通知(这似乎与上述文档的语言矛盾)。

What do I need to do to enable push notifications in my app for turn-based events? Do I need to actually send a local notification when I receive the above method (this would seem to contradict the intent, given the verbiage of the above doc).

推荐答案

我刚刚完成了战斗,通过这一点,经过一个多星期左右我的头撞在桌子上我发现了这些重要的事情:

I just finished fighting my way through this, and after a week or so of banging my head against the desk I discovered these important things:

(1)模拟器不接收这些转向通知。一旦我做这项工作,它在两个设备之间工作正常。模拟器与设备之间会发送事件,但不会接收。所以如果你试图使用一个设备和模拟器来测试这个,祝你好运。使用两个设备。

(1) The simulator does not receive these turn notifications. Once I made this work, it works fine between two devices. A simulator playing versus a device will send events, but not receive them. So if you are trying to use one device and the simulator to test this, good luck. Use two devices.

(2)确保您已在iTunes连接中启用游戏中心启用,并确保您的应用程序中的CFBundleVersion匹配此版本。

(2) Make sure that you have "Game Center Enabled for this Version" turned on in iTunes connect, and make sure that the CFBundleVersion in your app matches this version. As soon as I did this, everything started working.

我假设你已经完成了:
[GKTurnBasedEventHandler sharedTurnBasedEventHandler] .delegate = YOUR_DELEGATE_CLASS;

I assume you have already done: [GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate = YOUR_DELEGATE_CLASS;

这篇关于如何获得GameKit基于回合的比赛的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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