简体   繁体   English

iPhone SDK 3.1.3升级到iPhone SDK 4 ApplicationWillTerminate和dealloc不被调用

[英]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. 我已将iPhone SDK从3.1.2升级到4。我在先前版本中开发的应用程序运行良好,但只有一个问题。

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? 如果是的话,还有其他人遇到过这个问题吗?

Thanks 谢谢

What you are seeing is the state-saving multitasking that all sdk4 apps do. 您所看到的是所有sdk4应用程序都执行的状态节省型多任务处理。 It isn't calling those methods because you app is not terminating, iOS is just saving the state and pushing it to the background. 它之所以没有调用这些方法,是因为您的应用程序没有终止,iOS只是保存状态并将其推送到后台。 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. 如果您查看新的sdk文档,则有一些方法可以让您的应用进入后台,这听起来像您想要移动“ willTerminate”方法中代码的位置。

Edit: Here is the documentation for those methods 编辑:这是这些方法的文档

applicationDidEnterBackground: applicationDidEnterBackground:

applicationWillResignActive: 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. 当内存不足时,它将以与3.x天后终止的方式相同的方式终止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM