Quit app when pressing home

后端 未结 3 564
轻奢々
轻奢々 2020-12-19 17:16

I my testing, when I exit (by pressing the home button) my app, it still is \"running\" in the background, thanks to the multitasking feature. However, I would like it to q

3条回答
  •  执笔经年
    2020-12-19 17:46

    I think it's more efficient to suspend an app, when pressing the "Home" button. There's overhead in constantly launching and terminating apps. It's worse for the iOS operating system, and it's worse for user experience - because they need to wait for the app to launch again. Not sure what benefits you gain from terminating an app. If it's for simulation testing, my advice is to avoid that functionality, because your testing environment should be as realistic as possible. If your purpose is to clear cache or to make updates - that can all be done programmatically from subroutines.

    Exiting subroutines

    • applicationWillResignActive
    • applicationDidEnterBackground
    • applicationWillTerminate

    Entering subroutines

    • applicationDidBecomeActive
    • applicationWillEnterForeground
    • applicatonDidFinishLaunching

    If you still insist on terminating an app when the user presses the "Home" button, despite the costs mentioned above - then set the UIApplicationExitsOnSuspend to true in your Info.plist as suggested by Brad Larson.

提交回复
热议问题