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

查看:45
本文介绍了iPhone SDK 3.1.3升级到iPhone SDK 4 ApplicationWillTerminate和dealloc不被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将iPhone SDK从3.1.2升级到了4.我在先前版本中开发的应用程序运行良好,但是只有一个问题.

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?

谢谢

推荐答案

您看到的是所有sdk4应用程序都执行的状态节省型多任务处理.它之所以没有调用这些方法,是因为您的应用程序没有终止,iOS只是保存状态并将其推送到后台.如果您注意到,现在按下主页按钮时,调试器也不会脱钩.如果您查看新的sdk文档,则有一些方法可以让您的应用进入后台,这听起来像是您想要移动"willTerminate"方法中代码的位置.

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.

这是这些方法的文档

applicationDidEnterBackground:

applicationWillResignActive:

这篇关于iPhone SDK 3.1.3升级到iPhone SDK 4 ApplicationWillTerminate和dealloc不被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆