gpt4 book ai didi

iphone - applicationWillEnterForeground 从未调用过

转载 作者:搜寻专家 更新时间:2023-10-30 20:01:36 24 4
gpt4 key购买 nike

嘿,我正在模拟器中尝试多任务处理(我只有第二代 iPod 和 iPad),但我仍然遇到一些问题。我的测试方法如下所示:

- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"Entering %s",__FUNCTION__);

if (enteredFromBackground) {
NSLog(@"Entering from Background");
enteredFromBackground = NO;
}
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
NSLog(@"Entering %s",__FUNCTION__);

enteredFromBackground = YES;
}

不幸的是,我没有看到来自 applicationWillEnterForeground 的 NSLog,这就是为什么我添加了一行以在 applicationDidBecomeActive 中显示一些内容。我得到的只是

2010-11-20 15:58:12.796 iBeat[45997:207] Entering -[AppDelegate_Shared applicationDidEnterBackground:]
2010-11-20 15:58:18.160 iBeat[45997:207] Entering -[AppDelegate_Shared applicationDidBecomeActive:]

最佳答案

在 iOS 13 中出现此问题后,我发现我正在等待调用 applicationWillEnterForeground(_ application: UIApplication) 而不是 sceneWillEnterForeground(_ scene: UIScene)

有关更多信息,请阅读此答案:

enter link description here

关于iphone - applicationWillEnterForeground 从未调用过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4233315/

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