如何告诉iOS,我不想让应用程序保留在后台? [英] How do I tell iOS that I do not want the app to stay in the background?

查看:171
本文介绍了如何告诉iOS,我不想让应用程序保留在后台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法告诉iOS,我不想让我的应用程序留在后台?

Is there a way to tell iOS that I do not want my app to stay in the background? In other word, can I tell my app to quit itself whenever getting into the background?

我使用 ABPeoplePickerNavigationController 在我的UITbarController的标签之一。但是,每当它到达 [ABMembersViewController applicationDidResume] 时,它就会与一个EXC_BAD_ACCESS崩溃。

I am using ABPeoplePickerNavigationController in one of the tabs in my UITbarController. However, it crashes with a EXC_BAD_ACCESS whenever it reaches [ABMembersViewController applicationDidResume].

/ p>

Here comes the stack trace:

0x00cc5994  <+0034>  mov    0x8(%eax),%eax
0x00cc5991  <+0031>  mov    0x8(%ebp),%eax
0x00cc598d  <+0027>  mov    %eax,0x4(%esp)
0x00cc5987  <+0021>  mov    0x4e082(%ebx),%eax
0x00cc597f  <+0013>  movl   $0x0,0x8(%esp)
0x00cc597e  <+0012>  pop    %ebx
ABCGetGroupCount
-[ABAccountsAndGroupDataSource hasMultipleAccountsOrGroups]
-[ABMembersViewController updateNavigationButtonsInSearchMode:animated:]
-[ABMembersViewController updateNavigationButtonsAnimated:]
-[ABMembersViewController applicationDidResume]

因此,为了解决这个问题,我认为如果我能够强制应用程序终止,我可以美妙地防止程序通过这部分代码。

So, in order to work around it, I figure that if I am able to force the app to terminate itself, I can beautifully prevent the program to go through this part of the code.

推荐答案

在你的info.plist,设置UIApplicationExitsOnSuspend是

in your info.plist, set UIApplicationExitsOnSuspend to yes

这篇关于如何告诉iOS,我不想让应用程序保留在后台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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