运行Simulator 4.0的iPhone应用程序收到Sigkill [英] iPhone app running Simulator 4.0 received Sigkill

查看:147
本文介绍了运行Simulator 4.0的iPhone应用程序收到Sigkill的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚得到了iPhone SDK 4,我试图离开开发我以前工作的应用程序。所以我实现了
- (void)applicationDidEnterBackground:(UIApplication *)应用程序
- (void)applicationWillTerminate :( UIApplication *)应用程序



当我点击模拟器4.0中的主页按钮,似乎工作正常。应用程序调用 - (void)applicationDidEnterBackground :( UIApplication *)应用程序并进入后台状态..



,然后双击主页按钮来显示在后台运行的应用程序,并按住它可显示减号或退出。当我点击减号时,调试器说


程序接收到的信号:SIGKILL




另外, - (void)applicationWillTerminate :( UIApplication *)应用程序从未被调用。我错过了一些我需要做的工作,在OS4上工作吗?或者至少可以有人指出我要调试SIGKILL。谢谢。

解决方案

-applicationWillTerminate:仅在您的应用程序处于运行状态当被要求退出时。如果它已经处于暂停状态(如您在这里),则系统只需向应用程序发送杀死信号。当用户按下红色减号按钮手动终止应用程序时,以及系统决定放弃应用程序以释放前台应用程序的内存时,会发生这种情况。



如果您的应用程序在后台运行(例如播放音乐或运行某些后台任务),并且用户通过按减号手动手动终止应用程序,则只有这样,您才能实际获得 -applicationWillTerminate: / code>消息。因此,您必须保存所有状态/ etc。在您从 -applicationDidEnterBackground返回之前:


I just got the iPhone SDK 4 and I'm trying to leave off developing an app I was working on before. So I implemented both -(void)applicationDidEnterBackground:(UIApplication *)application and - (void)applicationWillTerminate:(UIApplication *)application

When I click the home button in the simulator 4.0, it seems to work okay. The app calls -(void)applicationDidEnterBackground:(UIApplication *)application and enters the background state..

However, I then double click the home button to expose the app running in the background, and hold it down to show the minus sign in or to exit. When I click the minus sign, the debugger says

Program received signal: "SIGKILL"

in addition, - (void)applicationWillTerminate:(UIApplication *)application is never called. Am I missing something I need to do for this to work on OS4? Or at least can somebody point me to a way to debug SIGKILL. Thanks.

解决方案

-applicationWillTerminate: is only called if your application is in a running state when it is asked to quit. If it is already in a suspended state (as you have it here), the system simply sends a kill signal to the application. This happens when the user presses the red minus buttons to terminate the app manually as well as when the system decides to jettison the app to free up memory for the foreground application.

If you application is running in the background (playing music or running some background tasks, for instance) and the user manually terminates the application by pressing the minus button, only then will you actually get an -applicationWillTerminate: message. Therefore, you must save all your state/etc. before you return from -applicationDidEnterBackground:.

这篇关于运行Simulator 4.0的iPhone应用程序收到Sigkill的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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