gpt4 book ai didi

iphone - 如何检查 GameKit UI 何时显示

转载 作者:行者123 更新时间:2023-12-03 21:19:15 34 4
gpt4 key购买 nike

我有一个非常简单的游戏,我正在尝试连接到游戏中心。

调用后:

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {

}];

第一次时,游戏中心对话框会出现,要求输入用户名和密码,然后整个游戏中心窗口会向上滑动以设置帐户。

问题是我的游戏仍在该窗口下运行,我只是找不到任何通知来暂停它。

UIViewController 中的 viewWillDisappear、viewDidDisappear 不会被调用; AppDelegate 中的 applicationWillResignActive 也不会被调用。

有什么方法可以检测游戏中心窗口的显示吗?

最佳答案

用户验证通过后可以开始游戏吗?

这是 Apple 文档中的示例 (http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Users/Users.html)

- (void) authenticateLocalPlayer
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.isAuthenticated)
{
// Start Game
}
}];
}

关于iphone - 如何检查 GameKit UI 何时显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6524618/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com