I find I can crash my iOS app by performing the following:
So far:
I'm doing this very quickly, though, so I'm curious if it's likely to be a bug in my app (and what the bug could be) or if springboard is killing my app just as I'm restarting it?
The debugger reports that my app received the signal "SIGKILL" so I'm inclined to believe it's just a delay in actually killing the process, but I don't want to overlook a mistake I might have made.
Given that I can't repeat it outside the debugger it's low priority for me, but I'd still like to understand it better if possible, especially if it points to an error in my app.
Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the proper app updates installed.
Causes of iPhone App CrashLow device memory. Network issues. Device incompatibility problems. Software issues such as outdated software.
When you kill your app, the OS sends it SIGKILL. Normally this kills your app, but since there's a debugger attached, the app is suspended instead to give you a chance to debug the cause of the signal (there probably ought to be an exception for SIGKILL, but it's not a big problem that there isn't one).
When you launch it again, SpringBoard (the home screen) notices that the app isn't dead and switches to it. [1] At this point, there's nothing it can do since the app is suspended. I think SpringBoard handles an unresponsive app by sending it SIGKILL and waiting for the app to die, but GDB's still attached, your app's still suspended, and nothing happens.
At this point I usually click Xcode's stop button, or if that doesn't work (because Xcode 4 is a buggy POC) unplug the phone.
And if you're wondering why SpringBoard doesn't simply ignore the old instance of your app and spawn a new one: There Can Only Be One Instance Running. Apps make that assumption all the time (e.g. there isn't another instance of your app accessing its database), and I'm pretty sure there's something about Mach ports/bootstrap namespaces/something that means your app won't launch if there's another copy running (or if a part of the system thinks your app is still running because something failed to do cleanup).
On an older OS version, if your app spent a lot of time doing something at exit (e.g. saving), exiting and quickly "re-launching" the app would switch to the in-the-process-of-exiting app, and the app would finish exiting, and the home screen would suddenly appear. I forget which OS version I saw this in, but I think it's fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With