多任务处理和终止

发布于 2024-09-19 05:01:18 字数 136 浏览 5 评论 0原文

如果用户通过多任务栏杀死您的应用程序(如果它已移至后台),是否有可能对该事件做出反应?根据我的观察,applicationWillTerminate: 不会被调用。

在我看来,在这种情况下,在退出之前不可能进行清理。

Is there any possiblity for reacting to the event that a user kills your app via the multitasking bar if it has moved to the background? According to my observations, applicationWillTerminate: does NOT get called.

It seems to me that there is no possiblity for cleaning up before quitting in this case.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

又爬满兰若 2024-09-26 05:01:18

如果应用程序需要执行任何清理或关闭操作,在 iOS 4.x 下,它应该在调用应用程序的挂起委托时执行此操作,就在应用程序发送到后台之前,因为不能保证应用程序将获得任何清理或关闭操作。由于用户操作或内存清理而再次运行。

如果应用程序的部署目标还包括 iPhone OS 3.x,那么它还应该在其终止委托中进行清理,因为它将被调用而不是挂起。

If an app needs to do any cleanup or shutdown, under iOS 4.x it should do this when the app's suspend delegate gets called, just before the app gets sent to the background, since there is no guarantee that the app will ever get any run time again, either due to user action or memory cleanup.

If the app's Deployment Target also includes iPhone OS 3.x, then it should also do cleanup in its terminate delegate, as that will get called instead of suspend.

无戏配角 2024-09-26 05:01:18

它应该被调用。你是否依赖 NSLog 来告诉你它何时被调用?当应用程序通过按主页按钮进入非活动状态时,任何其他 NSLog 都不会打印到控制台。您可以尝试显示一个小的 UIAlertView 以查看它是否被调用。

It should get called. Are you depending on NSLog to tell you when it does get called? When an app goes into the inactive state by pressing the home button then any further NSLogs are not printed to the console. You could try showing a small UIAlertView to see of it does get called instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文