在 iOS 9 中,Apple 弃用public func turnBasedMatchmakerViewController(_ viewController: GKTurnBasedMatchmakerViewController, didFind match: GKTurnBasedMatch)
了GKTurnBasedMatchmakerViewControllerDelegate
.
苹果的方向是func player(_ player: GKPlayer, receivedTurnEventFor match: GKTurnBasedMatch, didBecomeActive: Bool)
使用GKLocalPlayerListener
.
仅使用receivedTurnEventFor match
会导致以下情况:
- 用户点击
+
显示GKTurnBasedMatchmakerViewController
. - 用户点击
Play Now
,Game Center 将搜索匹配项。 - Game Center 将返回一个空匹配
matchData
(新匹配),或者将用户置于一个正在进行的匹配中——并且游戏通过receivedTurnEventFor match
.
虽然确定是否已创建新匹配很简单(使用matchData
),但似乎没有一种方法可以确定是否已找到匹配与匹配是否在所有事件流过时更新receivedTurnEventFor match
。
我的问题是这样的:
使用GKLocalPlayerListener
'sreceivedTurnEventFor match
方法时,有没有办法确定回合事件是否是匹配 find的结果?