应用程序从Xcode停止时未调用applicationWillTerminate [英] applicationWillTerminate not called when application stopped from Xcode

查看:91
本文介绍了应用程序从Xcode停止时未调用applicationWillTerminate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题, - (void)applicationWillTerminate:(UIApplication *)application {} - (void) applicationDidEnterBackground:(UIApplication *)application {} 在我尝试从Xcode停止应用程序而不是主页按钮时不会被调用。

I have got into an strange issue, where the - (void)applicationWillTerminate:(UIApplication *)application{} and - (void)applicationDidEnterBackground:(UIApplication *)application{} are not called when I try to stop the application from Xcode as opposed to home button.

推荐答案

这种行为是预期的,因为Xcode是而不是 iOS设备上的主页键。

This behavior is expected, because Xcode is not the home key on your iOS device.

如果你单击构建并运行,例如,在测试另一个应用程序时,系统将提示您终止第一个应用程序。如果你这样做,那么第一个应用程序将关闭,就好像它从未打开过一样。这似乎是应用程序打沙的结果。

If you click "Build and Run", for example, while testing another app, you will be prompted to kill the first app. If you do, then the first app will close as if it never opened. This seems to be a consequence of the application sand-boxing.

在类似的说明中,如果您在支持多任务处理的设备上测试应用程序时点击主页键,则该应用程序将继续在后台模式下运行,它不会触发 applicationWillTerminate 。但是,您的设备应触发 applicationDidEnterBackground

On a similar note, If you hit the home key while testing an app on a multitasking capable device, then the app will continue to run in background mode and it will not trigger applicationWillTerminate. Your device should however, trigger applicationDidEnterBackground.

这篇关于应用程序从Xcode停止时未调用applicationWillTerminate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆