6

我目前正在使用 Game Center Sandbox 测试我的 Game Center Aware 应用程序,其中一个实例在 iOS 模拟器上运行,另一个在 Retina iPad Mini 上运行。我有一个需要接收转弯事件的视图控制器,所以我实现了该方法

player:receivedTurnEventForMatch:didBecomeActive:

在我的 UIViewController 子类采用的 GKLocalPlayerListener 协议中,然后用这一行注册事件

[[GKLocalPlayer localPlayer] registerListener: self];

在视图控制器的 init 方法中。然而,尽管Game Center App说游戏的两个实例已经连接,但这个方法在iPad上很少调用,我想我从来没有见过模拟器实例调用它。但是,进入 Game Center 应用程序显示两个实例都已更新,表明两个实例都能够接收事件。这可能是什么原因造成的?

4

2 回答 2

2

I had the same problem on iOS 7/Xcode 5/iPhone 5. To fix that issue you need just add "Game Center" entitlement to your App ID. You can do that by navigating to project's "Capabilities" tab in Xcode.

Please note that player:receivedTurnEventForMatch:didBecomeActive: will be fired on devices only.

于 2013-12-25T18:06:12.473 回答
1

我在模拟器上发现这个问题的解决方法是调用

loadMatchDataWithCompletionHandler:

在 UI 中按下刷新按钮时的方法,这会导致在模拟器中加载匹配数据。

于 2013-12-25T18:55:24.930 回答