Search code examples
iosiphoneobjective-cgoogle-analyticsnsrangeexception

google analytics last screen before crash for ios


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

Solution

  • 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.
    }