gpt4 book ai didi

iphone - 如何区分打电话后重新启动的应用程序和从跳板启动的应用程序?

转载 作者:行者123 更新时间:2023-11-29 04:33:54 25 4
gpt4 key购买 nike

我希望我的应用程序具有不同的功能,具体取决于它是否在后台仍处于事件状态(即未完全退出)时启动,以及在电话调用后重新启动时启动。可能吗?

我在 stackoverflow 上找到的答案大多与如何在通话后恢复有关。

编辑:我在 2008 年的苹果论坛上找到了这个问题的答案,其中涉及根据您的平均通话时间进行扣除,看起来这仍然是最有效的选择?

最佳答案

在您的应用程序委托(delegate)中,有两种方法将在您的应用程序运行时被调用,例如接到电话时:

- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

当您的应用程序再次激活时调用。

- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

如果您的应用程序在后台运行或在通话开始时未运行,则 肯定 无法判断是否已调用电话。

关于iphone - 如何区分打电话后重新启动的应用程序和从跳板启动的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11307322/

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