Reputation: 2535
My application crashes with very poor info. Is there a way that I could find the last screen name, in google analytics, when application crashes? I am tracking every screen in my application. This way I could know in what controller the bug exists. Thanks for any help!
Edit Crash report:
NSRangeException Trace: <redacted> <redacted> <redacted> <redacted> <redacted> <redacted> <redacted> <redacted> <redacted> CFRunLoopRunSpec
Upvotes: 6
Views: 3269
Reputation: 4466
I faced similar issue and came across with a multi tier solution : Google Analytics provides two-way exception mechanism.
1-> manual tracking :
@try {
NSArray *myArray = [self getListOfStudents];
}
@catch (NSException *exception) {
[tracker sendException:NO // Boolean indicates non-fatal exception.
withDescription:@"Unable to connect %d: %@", connectionError, errorDescription];
}
2-> Automatic tracking :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions
(NSDictionary *)launchOptions {
[GAI sharedInstance].trackUncaughtExceptions = YES; // Enable the automatic tracking
// ... rest follows here.
}
Hope this helps
Upvotes: 0
Reputation: 322
I came across a similar situation using Google Analytics with my app. I was able to get more information from the Crashes and Exceptions page that shows all the errors by clicking on Secondary Dimension -> Engagement -> Screen Name. This shows the screen where the crash/error occurred.
Upvotes: 25
Reputation: 2383
Have you tried the Crash and Exception Analysis in GA?
You can find more details about the analysis here: https://developers.google.com/analytics/devguides/collection/ios/v2/exceptions
Examples of tracking code from the page:
@try {
NSArray *highScores = [self getHighScores];
}
@catch (NSException *exception) {
[tracker sendException:NO // Boolean indicates non-fatal exception.
withDescription:@"Connection timout %d: %@", connectionError, errorDescription];
}
and automatic tracking for uncaught exceptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GAI sharedInstance].sendUncaughtExceptions = YES; // Enable
// ... the rest of your code, include other GAI properties you want to set.
}
Upvotes: 1