ios gamenetwork SetEventListener - invitationReceived is not working

Hi,

what is the purpose of the invitationReceived event type? It never receives any data. If someone sends me a direct invitation I’d expect the invitationReceived event type to get a notification. But nothing happens. If I tap the Game Center banner that slides down, “playerTurn” is called. So there’s a missing link here since there’s no way to know in the app if an invitation to play is received.

When someone invites me directly I’d expect the invitationReceived event type in the gameNetwork SetEventListener to be notified.

gameNetwork.request( “setEventListener”,

{

    listener = function(event)

         if event.type == “invitationReceived” then

            print(“I’m totally not needed, never gets called anyway…”)

        end

    end

})

CoRobrona? Anyone? What should I do in the Game Network world that triggers the invitationReceived type?

Or how about turning it around: Why have you implemented that event type in the gameNetwork listener - what was your intention, and is that intention something that used to work (but doesn’t anymore)?

I ran into this same issue a few weeks back. After extensive testing I (like you) found that the event type “invitationReceived” is never returned. When a user receives a Game Center invitation from another player and they tap the banner at the top of the screen, the event type that is returned to the callback listener is “playerTurn”. The same is true if a user receives an alert telling them it’s their turn to play. This was problematic for me because I wanted to be able to handle both of those situations in a specific way, depending on if the app was already running in the background or starting fresh, and (if already running) what screen the user was currently on.

I solved this by checking several different things in the “playerTurn” callback listener. Firstly, I added a “playCount” variable to my match data that increments up each time a play has been made. I also added a local variable called “recentLogin” and timer to the callback listener for gameNetwork.init() that sets “recentLogin” to true for a couple of seconds. So, I check “playCount” (to see if it’s lower than the total number of players in the game–meaning it’s the player’s first turn), “recentLogin”, the current scene name (available with the composer library by running “composer.getSceneName()”), and the matchID received in the “playerTurn” event (which I compare to the current matchID that’s stored in a local variable). Using those items you can accurately determine what’s happening when “playerTurn” gets returned. It is a bit of a workaround, but it accomplished what I needed. Hopefully in the future we’ll have a functioning “invitationReceived” event and also a “playerTurnNotice” event (or whatever) so we know when a player has responded to either an invitation banner or a banner telling them it’s their turn to play.

CoRobrona? Anyone? What should I do in the Game Network world that triggers the invitationReceived type?

Or how about turning it around: Why have you implemented that event type in the gameNetwork listener - what was your intention, and is that intention something that used to work (but doesn’t anymore)?

I ran into this same issue a few weeks back. After extensive testing I (like you) found that the event type “invitationReceived” is never returned. When a user receives a Game Center invitation from another player and they tap the banner at the top of the screen, the event type that is returned to the callback listener is “playerTurn”. The same is true if a user receives an alert telling them it’s their turn to play. This was problematic for me because I wanted to be able to handle both of those situations in a specific way, depending on if the app was already running in the background or starting fresh, and (if already running) what screen the user was currently on.

I solved this by checking several different things in the “playerTurn” callback listener. Firstly, I added a “playCount” variable to my match data that increments up each time a play has been made. I also added a local variable called “recentLogin” and timer to the callback listener for gameNetwork.init() that sets “recentLogin” to true for a couple of seconds. So, I check “playCount” (to see if it’s lower than the total number of players in the game–meaning it’s the player’s first turn), “recentLogin”, the current scene name (available with the composer library by running “composer.getSceneName()”), and the matchID received in the “playerTurn” event (which I compare to the current matchID that’s stored in a local variable). Using those items you can accurately determine what’s happening when “playerTurn” gets returned. It is a bit of a workaround, but it accomplished what I needed. Hopefully in the future we’ll have a functioning “invitationReceived” event and also a “playerTurnNotice” event (or whatever) so we know when a player has responded to either an invitation banner or a banner telling them it’s their turn to play.