|
|
#1 |
|
handling app crash
I was recently playing with an app and it suddenly crashed (it's happened to all of us). But, when I re-launched the app I got an alert that said, "Our app quit unexpectedly, would you like to send an error report so we can fix this?" This made me curious for two reasons:
1.) How was their app able to detect that it had crashed? 2.) What information did their app send that would help them fix the crash? Thank you for any help! Last edited by straber; Mar 17, 2013 at 09:05 PM. |
|
|
|
0
|
|
|
#2 |
|
It might not be so sinister.
It could write a key when it exits and detect the Value is incorrect at startup. 2) values of working variables, state, etc. all the usual. |
|
|
|
0
|
|
|
#3 |
|
I don't know much about this, but arent all app crashes recorded by the system and written to a log file somewhere? You can see this log file when you plug your device into Xcode.
|
|
|
|
1
|
|
|
#4 |
|
It's true, you can get crash logs through Xcode, but that's not what I'm looking for. I'm trying to figure out how an app can detect that it's crashed all on its own after it's been released to customers.
|
|
|
|
0
|
|
|
#5 |
|
Do this at startup:
Code:
cleanexit = [[NSUserDefaults standardUserDefaults] integerForKey:@"exit"];
if (cleanexit == 0) {// do something like send crash log}
cleanexit = 0;
[[NSUserDefaults standardUserDefaults] setInteger:launchkeyval forKey:@"exit"];
[[NSUserDefaults standardUserDefaults] synchronize];
Code:
cleanexit = 1;
[[NSUserDefaults standardUserDefaults] setInteger:launchkeyval forKey:@"exit"];
[[NSUserDefaults standardUserDefaults] synchronize];
or it crashed the last time it was run.
__________________
Mac Mini, iPhone 4S, iPhone 5, iPad 3rd Gen, iPad mini. |
|
|
|
1
|
|
|
#6 | |
|
Quote:
|
||
|
|
0
|
|
|
#7 |
|
You could keep track of when large tasks are in progress... maybe if it takes 5 seconds to parse a large XML file, for example, you could know which file it was parsing when it crashed.
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed. Like it on Facebook! |
|
|
|
0
|
|
|
#8 |
|
Rather than rolling your own, you might want to consider incorporating something like TestFlight SDK, which has crash reporting in realtime.
__________________
|
|
|
|
0
|
|
|
#9 |
|
I ended up writing this function in my app delegate.
Code:
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}
Code:
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 05:42 AM.







I support the
Linear Mode
