Search code examples
iosfirebase-performance

Firebase Performance crashes the app on the first call to NSURLSession


I have just added Firebase Performance to my which is mainly Obj-C and has Firebase (Core + Analytics + Messaging + Config) I read in the docs that:

Performance Monitoring does not support network requests made using the NSURLConnection class.

However what's not expected is that the app crashes on the first call of NSURL* e.g. I'm using a lib called "Harpy" which checks for new version of the app in the AppStore and it crashes here:

NSURLSession *session = [NSURLSession sharedSession]; // <--- Crashes here
NSURLSessionDataTask *task = [session
      dataTaskWithRequest:request
        completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            if ([data length] > 0 && !error) { // Success
                [self parseResults:data];
            }
        }
];

I can't really see any useful exception however the thread starts with:

Thread 1 Queue : com.google.FPRNSURLSessionInstrumentation (serial)

Solution

  • So issue above was not directly related to Firebase itself, but actually to a conflict between Firebase Performance and Crittercism, the solution was to disable Crittercism's monitoring for NSURLSession as follows:

    CrittercismConfig *config = [CrittercismConfig defaultConfig];
    config.monitorNSURLSession = false;
    [Crittercism enableWithAppID:settingsManager.crittericismKey andConfig:config];
    [Crittercism setValue:[NSLocale preferredLanguages].firstObject forKey:@"deviceLanguage"];