0

I have a view that lists all available matches for a local player (which was registered as the listener). The problem I have is that I want my list to update when the player receives an invitation for a new match.

I tried implementing:

func player(_ player: GKPlayer, didAccept invite: GKInvite) {

}

func player(_ player: GKPlayer, didRequestMatchWithOtherPlayers playersToInvite: [GKPlayer]) {

}

But those methods never get called.

I do get notification of other events, such as turnBasedMatchmakerViewController(_ viewController: GKTurnBasedMatchmakerViewController, didFind match: GKTurnBasedMatch) and player(_ player: GKPlayer, receivedTurnEventFor match: GKTurnBasedMatch, didBecomeActive: Bool)

Also, I do get the banner from Game Center at the top of the screen, and if I tap it, it does register the turn event, but it just won't detect when an invite is received.

Any suggestions?

4

1 回答 1

0

我写了一个抱怨didAcceptInvite永远不会触发的错误。苹果关闭了这个错误,说这是故意的,didAcceptInvite它只适用于实时匹配(即使文档没有这么说)。

我想做你描述的同样的事情:提供一个始终最新的匹配列表。尽管有游戏中心的通知,但我从未发现我可以检测到自己的事件。

最后,我将表格放在单独的视图上,并在每次显示视图或用户拉动刷新视图内的表格时查询所有匹配项的列表。我考虑过使用计时器来定期刷新列表,但实际上从未走那么远。

于 2017-04-23T17:46:53.913 回答