applicationWillTerminate: not being called

前端 未结 4 1530
猫巷女王i
猫巷女王i 2020-12-03 23:26

I\'m using applicationWillTerminate: to save some last-minute stuff. But the problem is that it never gets called. If I do something like this at the top of the

相关标签:
4条回答
  • 2020-12-03 23:36

    Use applicationDidEnterBackground: instead. Applications aren't terminated when you press the home button in a multitasking system.

    0 讨论(0)
  • 2020-12-03 23:45

    From the iOS Application Programming Guide on Core Application Design and Application life time:

    The applicationWillTerminate: method is not called if your application is currently suspended.

    If you are linking against iOS 4.0, you should also save data in applicationDidEnterBackground:.

    0 讨论(0)
  • 2020-12-03 23:59

    From Apple docs:

    For applications that do not support background execution or are linked against iOS 3.x or earlier, this method is always called when the user quits the application. For applications that support background execution, this method is generally not called when the user quits the application because the application simply moves to the background in that case. However, this method may be called in situations where the application is running in the background (not suspended) and the system needs to terminate it for some reason.

    If your app has background enabled use:

    - (void)applicationDidEnterBackground:(UIApplication *)application

    0 讨论(0)
  • 2020-12-04 00:01

    step 1: command + shift + h (double click(tab))

    step 2: move app top side (kill)

    step 3: applicationWillTerminate Work

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