Game Center Invitation handler, Where does it belong?

好久不见. 提交于 2019-12-10 18:07:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!