3

I already searched the site and found this:

GameCenter Invitation Handler

He says:

"

As stated in the docs

Your application should set the invitation handler as early as possible after your application is launched; an appropriate place to set the handler is in the completion block you provided that executes after the local player is authenticated.

"

.. OK, that's cool, but!

I would like Authenticate the player ONLY if an invitation was received .. Example:

Scenarios:

The player launches the game, plays single player mode, exits the game. [No Game center authentication].

The player accepts an invite, the game launches, invitation handler receives an invitation notification, authenticates the player, game starts.

The player chooses an online game, Game center authenticates the player.

..

So, My point is, I don't want to authenticate the player unnecessarily .. if possible. Which leads to the question, where should I place the invitation handler code? Obviously not after the authentication, since, as I already said, I don't want to authenticate the player unnecessarily ...

Thanks =)

Community
  • 1
  • 1
Mazyod
  • 22,319
  • 10
  • 92
  • 157
  • related [How to deal with game center invitations, if the friend has not progressed far enough in the app to reach the installInvitationHandler method?](https://stackoverflow.com/questions/14465064/how-to-deal-with-game-center-invitations-if-the-friend-has-not-progressed-far-e) – Drux Mar 25 '14 at 07:03

1 Answers1

2

After days of thinking and searching, seems like you HAVE to authenticate the local player and initiate the invitation handler upon successful authentication .. This is the only way to support invitations in your game ..

Mazyod
  • 22,319
  • 10
  • 92
  • 157
  • +1 Can you please explain why you have come to the conclusion? I would like to support a scenario where Game Center is available as an option (for in-app purchase). I install the authentication handler only if the purchase is made. Yet I would like to display a dialog box when an invitation arrives prior to purchase (i.e. inviter made purchase, invitee not yet). This is for iOS 7 and a turn-based game. – Drux Mar 25 '14 at 06:49
  • 1
    @Drux It was a process of elimination. I tried to initiate an invitation process, but it never worked without authenticating and installing the invitation handler as soon as the app launches. In your case, I __urge__ you to install the invitation handler _even if the user hasn't bought the IAP_. When he gets an invitation, invite him to buy if he wants to proceed. – Mazyod Mar 25 '14 at 07:19