问题
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 =)
回答1:
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 ..
来源:https://stackoverflow.com/questions/6285124/game-center-invitation-handler-where-does-it-belong