有什么方法可以控制游戏中心身份验证的发生时间吗?

发布于 2024-12-16 16:06:54 字数 701 浏览 2 评论 0原文

以下代码在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

番薯 2024-12-23 16:06:54

不,你不能,至少对于公共 API 来说不能。

No, you can't, at least not with public APIs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文