我不知道该怎么称呼这种状态。所以为标题错误道歉。
有没有办法让我检查用户是否要离开我的应用程序。例如,当用户在主屏幕上点击 2 次时,会显示最近打开的应用程序。我想知道这种状态,所以我可以在我的应用程序上修改一些东西。
我检查所有代表方法都没有涵盖这一点。applicationWillResignActive:
&applicationDidEnterBackground:
没有被解雇。
提前致谢。
You can't detect this. From the iOS App Programming Guide ("App Termination" heading):
Important: The applicationWillTerminate: method is not called if your app is currently suspended.
Even if you develop your app using iOS SDK 4 and later, you must still be prepared for your app to be killed without any notification. The user can kill apps explicitly using the multitasking UI. In addition, if memory becomes constrained, the system might remove apps from memory to make more room. Suspended apps are not notified of termination but if your app is currently running in the background state (and not suspended), the system calls the applicationWillTerminate: method of your app delegate. Your app cannot request additional background execution time from this method.