OGeek|极客世界-中国程序员成长平台

标题: ios - 有什么方法可以控制何时使用 Game Center 进行身份验证? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:32
标题: ios - 有什么方法可以控制何时使用 Game Center 进行身份验证?

以下代码在 applicationDidFinishLaunching: 时被调用一次;但是,每次我的应用重新进入前台时它都会运行。

[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
    if (localPlayer.isAuthenticated)
    {
        // Some implementation
    }
}];

这是有道理的,根据 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.

有什么方法可以延迟这个身份验证,直到真正需要 Game Center?我问的原因是我想避免显示“欢迎回来,userX!”每次将应用程序置于前台时都显示横幅。



Best Answer-推荐答案


不,你不能,至少不能使用公共(public) API。

关于ios - 有什么方法可以控制何时使用 Game Center 进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8194469/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4