我正在尝试向 GKTurnBasedMatch 中的另一位玩家发送交换。当我发送它时,我的完成处理程序会收到一条大错误消息,其中包含以下描述:
The requested operation could not be completed because the session is in an invalid state.
Game is not active, session state is Matching
我希望比赛在只有两名球员时开始,但总共允许 16 名球员。所以我很自然地设置maxPlayers = 16
and minPlayers = 2
。我原以为一旦两名球员就座,比赛就会自动开始,但事实并非如此。
一旦比赛有两名球员,我就尝试这样做:
if match.participants?.count == 2 {
match.status = GKTurnBasedMatchStatus.open
}
但后来我被告知这status
是只读的。我不能手动设置它。
现在,有了一个常规的GKMatch
,我通过调用正式开始比赛:
GKMatchmaker.shared().finishMatchmaking(for: match)
但似乎没有类似的东西GKTurnBasedMatch
。
我如何真正开始比赛,以便我可以在两个玩家之间进行交流?