Crash in exit app from backround with twice click on home button - ios

I have an app that work in background because i add App provides Voice over IP services to info.plist
when my app go to background and touch twice on home button and exist app from background , it crashed
how can i check why happen this problem?does any event call from AppDelegate when do it?

In Navigator -> Breakpoint Navigator: Add Exception Breakpoint
Now simulate your crash, your application will stuck on the line your app got stuck, check thread and objects allocations.
I guess this may help you out a little bit :)

Related

Detect stop button Xcode pressed

Is it possible to add in AppDelegate to detect when the app stopped running after pressing the Stop button here:
I know about applicationDidEnterBackground and applicationWillTerminate, but those won't run when tapping the Stop button in Xcode.
No you can't detect that as it's IDE internal work , also you mix between 2 separate things these 2 delegate methods applicationDidEnterBackground and applicationWillTerminate can be tested when you leave the app (Swipe up or go to home screen in your iphone/simulator without closing it)

Strange app crash when returning from background

This appears to be an iOS 8 problem only. I haven't seen it anywhere else, and it only happens on iOS 8. This is not local to my app, as it seems to affect nearly every app on my phone, including ones that haven't been updated to iOS 8. The crash is a EXC_CRASH (SIGABRT) which seems to trigger on random threads. The back trace is of no help of course because I can't re-symbolicate the crash reports from different builds and applications. So I decided to run my app in Xcode and recreate events that lead up to this crash. Essentially I just run my app so it's loaded, press the home button to switch to another app, do some stuff on my phone and return back to my app several seconds later. When I did get it to crash, and returned back to my app, instead of getting a SIGABRT and getting a stack trace, instead I get a SIGKILL and a (lldb) message in the console. This is strange because it does not crash while in the background but instead when returning to the foreground so any background process are uninterrupted. And because there is no stack trace, I have no idea why this is happening. To my knowledge, a SIGKILL is only given by Xcode when I press the stop button and when an app uses too much memory. Neither events occured. Has any one experienced this and/or solved it?

Objective c program behaving differently with and without breakpoints (XCode)

I am new to iOS development and i am facing an issue.
Putting breakpoints in my app before running the app in simulator is causing unexpected behavior.
If I put breakpoints in my app then I am not able to type in to text controls or click buttons i.e. it makes entire view read only.
If I disable the breakpoints, my app runs fine.
Any pointers to this issue will be really helpful.
Thanks
You are hitting a breakpoint which pauses execution of the main (UI) thread. Your application will not be able to process touch events when it is paused. Click the play button in Xcode to resume execution.

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

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!
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.
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..

Quit app when pressing home

I my testing, when I exit (by pressing the home button) my app, it still is "running" in the background, thanks to the multitasking feature. However, I would like it to quit when the home button is pressed. Is this only happening to me?
Anyway, I have tracked it down to the applicationWillResignActive and the applicationDidBecomeActive methods in the app delegate. These get called for multitasking, but when I want to terminate, the app "resigns active." Any guidance on this issue is greatly appreciated!
Your application can opt out of multitasking (see the appropriate section in the iPhone Application Programming Guide) by adding the UIApplicationExitsOnSuspend key to your Info.plist and setting its value to YES.
In practice, Apple strongly recommends you not do this unless you have a very good reason for this behavior.
I think it's more efficient to suspend an app, when pressing the "Home" button. There's overhead in constantly launching and terminating apps. It's worse for the iOS operating system, and it's worse for user experience - because they need to wait for the app to launch again. Not sure what benefits you gain from terminating an app. If it's for simulation testing, my advice is to avoid that functionality, because your testing environment should be as realistic as possible. If your purpose is to clear cache or to make updates - that can all be done programmatically from subroutines.
Exiting subroutines
applicationWillResignActive
applicationDidEnterBackground
applicationWillTerminate
Entering subroutines
applicationDidBecomeActive
applicationWillEnterForeground
applicatonDidFinishLaunching
If you still insist on terminating an app when the user presses the "Home" button, despite the costs mentioned above - then set the UIApplicationExitsOnSuspend to true in your Info.plist as suggested by Brad Larson.
I wouldn't recommend trying to control the user's HOME button... deciding for them "exit" or "suspend".
I WOULD like to have HOME do an instant EXIT in the iPhone simulator... but haven't found any way to do that.

Resources