多任务处理和终止
如果用户通过多任务栏杀死您的应用程序(如果它已移至后台),是否有可能对该事件做出反应?根据我的观察,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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果应用程序需要执行任何清理或关闭操作,在 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.
它应该被调用。你是否依赖 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.