Reputation: 6879
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?
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]
.
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.
Upvotes: 0
Views: 530
Reputation: 7104
Without seeing the rest of your code, it's hard to pinpoint the problem. Generally an EXC_BAD_ACCESS means you tried to send a message to a released object. Could you be releasing something in your viewWillDisappear or similar methods, and not re-initializing it in viewWillAppear?
Upvotes: 0
Reputation: 15813
Although causing the app to exit rather than suspend may fix the problem by hiding it, you should really address the problem properly and ensure your app can cope with suspension.
Users (on devices that support it) generally expect apps to suspend and may be surprised that yours appears to crash (this is how it will look to them) when they switch away to another app for whatever reason.
This will be especially annoying if to get back to where they were before, takes more effort than just relaunching the app.
Go on ... you know it makes sense ... do it properly!
Upvotes: 2