applicationWillTerminate not called when application stopped from Xcode

前端 未结 1 1137
栀梦
栀梦 2021-01-18 04:52

I have got into an strange issue, where the - (void)applicationWillTerminate:(UIApplication *)application{} and - (void)applicationDidEnterBackground:(UIA

相关标签:
1条回答
  • 2021-01-18 05:01

    This behavior is expected, because Xcode is not the home button 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 sandboxing.

    On a similar note, If you hit the home button 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.

    0 讨论(0)
提交回复
热议问题