Reputation: 22873
I am working on an iPad app. Sometimes it get crashed (I know the reason) but I am wondering why the app does not close even after a crash! When the app crash I got some error related to crash in console but the app does not close. It even appear in the multitasking bar (I can see that when I press home button two times). I am wondering is there some kind of setting for this? or this is a normal behavior?
Upvotes: 5
Views: 675
Reputation: 259
@Mike Weller is correct.
It is typical behavior of the simulator to not close the app upon a crash as the debugger is designed to stop at the point of code where the crash occurs (for obvious reasons!).
If you want to check it on device for your satisfaction. Connect your device, run the app once on it via xcode. Close app (stop on xcode). Then disconnect the device.
The app will be now installed on your device like any other normal app. Run this app and do whatever causes it to crash. You will see that the app will close and you will be thrown back to the iphone springboard screen.
As for app appearing in the multitasking bar, it has already been mentioned here that the presence of the app in the multitasking bar does not mean that it is still running. This is vital difference in architectures between ios and android.
The multitasking bar is NOT a task manager. The ios philosophy is that the user does not need to know that an app is running or not. He only needs to know which apps he has run in the past.
Upvotes: 3
Reputation: 45598
If you are running the App from Xcode, the debugger will still be attached so the crash will not terminate the process. You can use the Xcode debugger to take a look at the stack, inspect variables etc. Only when you stop the app in Xcode will the process be completely terminated.
Upvotes: 6
Reputation: 3398
The reason that it doesn't close, is probably that the app is actually not crashing.
Could it be so that the print you are seeing is an Exception that is printed to the log? Could it be that you are catching this exception after it is printed?
Like this:
@try {
[test characterAtIndex:6];
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
The above code would not crash, since the exception is caught. Catching an exception is telling the platform that you took care of the problem so the app does not need to crash.
There could be many other reasons, but with the info you provided this is my best guess. You could post the log print that you are seeing, that would certainly give a better clue...
Upvotes: 0