ApplicationWillTerminate in iOS 4.0

前端 未结 4 388
一整个雨季
一整个雨季 2020-11-29 22:40

The applicationWillTerminate delegate method is not getting called in iOS 4.0 When I hit the Home button I am seeing the applicationWillResignActive and applicationDidEnter

相关标签:
4条回答
  • 2020-11-29 22:49

    Actually you can also use this step to do so.

    1. Open your info.plist file
    2. Add The Key -> Application does not run in background
    3. Set this key value to YES
    0 讨论(0)
  • 2020-11-29 22:52

    The WWDC 2010 Session Adopting Multitasking on iPhone OS (Part 2) explains the application state transitions extremely well.

    0 讨论(0)
  • 2020-11-29 22:53

    From the iPhone Application Programming Guide:

    Even if you develop your application using iPhone SDK 4 and later, you must still be prepared for your application to be terminated. If memory becomes constrained, the system might remove applications from memory in order to make more room. If your application is currently suspended, the system removes your application from memory without any notice. However, if your application is currently running in the background, the system does call the applicationWillTerminate: method of the application delegate. Your application cannot request additional background execution time from this method.

    So yes, applicationWillTerminate: will generally not be called very often in iOS 4. If you have to save data, you should do so in both applicationWillTerminate: and applicationDidEnterBackground:.

    0 讨论(0)
  • 2020-11-29 22:54

    I got one solution for terminating apps when user hits the Home button in iOS4. This will call the applicationWillTerminate delegate method instead of entering into background process.

    1. Open your info.plist file
    2. Add The Key UIApplicationExitsOnSuspend
    3. Set the new key to YES
    0 讨论(0)
提交回复
热议问题