如何确定 receivedTurnEventFor 是否是 Invite?
How to determine if receivedTurnEventFor is an Invite?
阅读各种问题后,我了解到 GKTurnBasedMatches 的邀请在受邀用户轮到之前不会发送。该邀请是通过“ func player(_ player: GKPlayer,
receivedTurnEventFor match" class.
但我不确定此时如何处理邀请?我想向用户提供 Accept/Decline 邀请的机会。这是我应该写代码的地方吗:
if Received Turn Event == Invite { Ask To Decline/Accept }
如果是这样,我该怎么做?我如何确定是否有邀请,我如何 accept/decline 该邀请?
我相信我已经使用以下代码解决了这个问题:
if match.currentParticipant?.status == .invited {
print("Was invited")
// Present option to act on invite
}
阅读各种问题后,我了解到 GKTurnBasedMatches 的邀请在受邀用户轮到之前不会发送。该邀请是通过“ func player(_ player: GKPlayer, receivedTurnEventFor match" class.
但我不确定此时如何处理邀请?我想向用户提供 Accept/Decline 邀请的机会。这是我应该写代码的地方吗:
if Received Turn Event == Invite { Ask To Decline/Accept }
如果是这样,我该怎么做?我如何确定是否有邀请,我如何 accept/decline 该邀请?
我相信我已经使用以下代码解决了这个问题:
if match.currentParticipant?.status == .invited {
print("Was invited")
// Present option to act on invite
}