iPhone: Is it possible to close the app rather than run in background when user clicks Home Button?

坚强是说给别人听的谎言 提交于 2019-12-25 17:03:07

问题


I have an app which crashes everytime when I resume it.

I want that when user clicks Home button, the app should close rather than go in background mode.

Is that possible? If yes, please let me know.

If not, what could be the workaround so that my app does not crash when I resume it?

Thanks!


回答1:


In the plist, set YES to Application does not run in background key.

When ur application is in background, due to memory insufficient, the views (and the objects released in viewDidUnload) might be released. Again when reopen the application, make sure all the required objects are re-initialized.




回答2:


To opt out of background execution, see this thread... But ideally what you should do is fix the crash and let app user enjoy iOS background feature..

what could be the workaround so that my app does not crash when I resume it?

Never think of work arounds when you can handle it straight..



来源:https://stackoverflow.com/questions/6759882/iphone-is-it-possible-to-close-the-app-rather-than-run-in-background-when-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!