有什么方法可以控制游戏中心身份验证的发生时间吗?
以下代码在 applicationDidFinishLaunching:
时被调用一次;但是,每次我的应用程序再次重新进入前台时它都会运行。
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.isAuthenticated)
{
// Some implementation
}
}];
根据游戏套件编程指南:
...它还保留您的完成处理程序以供以后使用。每次您的应用程序从后台移至前台时,Game Kit 都会自动代表您再次对本地玩家进行身份验证,并调用您的完成处理程序以提供有关经过身份验证的玩家状态的更新信息。
有没有什么办法可以延迟此身份验证,直到真正需要游戏中心为止?我问的原因是我想避免显示“欢迎回来,userX!”每次应用程序被带到前台时都会出现横幅。
The following code is called once upon applicationDidFinishLaunching:
; however, it runs each time my app re-enters the foreground again.
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.isAuthenticated)
{
// Some implementation
}
}];
This makes sense, according to the Game Kit Programming Guide:
... it also retains your completion handler for later use. Each time your application is moved from the background to the foreground, Game Kit automatically authenticates the local player again on your behalf and calls your completion handler to provide updated information about the state of the authenticated player.
Is there any way to delay this authentication until Game Center is actually needed? The reason I ask is that I would like to avoid showing the "Welcome back, userX!" banner each and every time the app is brought to the foreground.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你不能,至少对于公共 API 来说不能。
No, you can't, at least not with public APIs.