Search code examples
iosgame-centergamekit

How to trigger [GKLocalPlayerListener player: didRequestMatchWithPlayers:]


The GKInviteEventListener Protocol contains the following method that must be implemented:

-(void)player:(GKPlayer *)player didRequestMatchWithPlayers:(NSArray *)playerIDsToInvite

But it is unclear how to trigger this method. The documentation says:

Called when the local player starts a match with another player from Game Center. (required)

When this method is called, the game is launched from Game Center and starts the matchmaking process.

In practice, there doesn't seem to be a way to "launch" games from the "Game Center" app. So how does one trigger this method?

Also, if one invites players from within the game (not the game center app), the corresponding method player:didAcceptInvite: is triggered on the "invitees" device, but player:didRequestMatchWithPlayers is not triggered on the inviters device (there doesn't seem to be a reason to, anyway.)

What is this method for? How does one trigger it being called, and what does one do in it ?

EDIT: From the game center app, I can choose to "play" my game, but there doesn't seem to be a way to invite other players to play my game.

Also keep in mind - it seems that there may be some configuration required to get game center to recognise my app as multiplayer. I want instructions on how to get game center to recognise my game as multiplayer so i can invite people from the app.

I have already configured it in iTunes connect, and can successfully matchmake or invite other players through my app. I just can't do it through the game center app, since it doesn't give me the option.

My app has not been released yet, and currently there is just one version. So under multiplayer compatibility this is the only one listed.


Solution

  • The secret is "...", but only after the right sequence of menu navigations!

    1. Open Game Center App
    2. Click on friends.
    3. Choose friend.
    4. In games in common, choose the game.
    5. Click on ...
    6. THEN click on play. This triggers the invite.

    If you go directly to the game and click ..., you can "play" the game, but are not given the option to invite anyone.