google analytics last screen before crash for ios

3.2k views Asked by At

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
3

There are 3 answers

1
Avi On BEST ANSWER

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.
}
1
Dan On

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.

0
iosCurator On

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