GKMatchMaker invite handler deprecated

后端 未结 4 984
我在风中等你
我在风中等你 2020-12-11 09:35

I have the following code that I have been using before to handle invitations:

[GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NS         


        
4条回答
  •  旧时难觅i
    2020-12-11 10:22

    I believe the answer is, annoyingly, different for a GKMatch and a GKTurnBasedMatch.

    For a GKTurnBasedMatch the invitation counts as a turn event, and is handled in this function:

    player(_ player: GKPlayer, receivedTurnEventFor match: GKTurnBasedMatch, didBecomeActive: Bool)

    That's inside the GKLocalPlayerListener protocol. You have to have officially registered GKLocalPlayerListener instance with your local player for this to work, so you can only do it after authentication.

    ...and it doesn't always work. Game Center is unreliable. But it does work sometimes, and that's... something?

提交回复
热议问题