如何告诉 iOS 我不希望应用程序留在后台? [英] How do I tell iOS that I do not want the app to stay in the background?
问题描述
有没有办法告诉 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?
我在我的 UITbarController 的一个选项卡中使用 ABPeoplePickerNavigationController
.但是,只要到达 [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]
.
堆栈跟踪来了:
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 设置为 yes
in your info.plist, set UIApplicationExitsOnSuspend to yes
这篇关于如何告诉 iOS 我不希望应用程序留在后台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!