iPhone SDK 3.1.3 upgrade to iPhone SDK 4 ApplicationWillTerminate and dealloc not being called
I have upgraded my iPhone SDK from 3.1.2 to 4. The application which I developed in previous version is running fine but I have only one problem.
When I close the application it is not calling application termination and deallocating anything. When I click home button application quits but when I open it again it opens exactly where I left it.
Does anyone else had this issue if yes how did you solve that?
开发者_StackOverflowThanks
What you are seeing is the state-saving multitasking that all sdk4 apps do. It isn't calling those methods because you app is not terminating, iOS is just saving the state and pushing it to the background. If you notice, the debugger doesn't unhook when you hit the home button now either. If you look into the new sdk documentation, there are methods when you app enters the background, which sound like the place you want to move the code that was in your 'willTerminate' method.
Edit: Here is the documentation for those methods
applicationDidEnterBackground:
applicationWillResignActive:
At a guess, I'd say that your application is not terminating, but is staying present in the background. It will be terminated when memory becomes scarce in the same way as it would be terminated in the 3.x days.
精彩评论