Firebase Performance crashes the app on the first call to NSURLSession

你。 提交于 2021-02-10 05:09:58

问题


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)

回答1:


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"];


来源:https://stackoverflow.com/questions/45266241/firebase-performance-crashes-the-app-on-the-first-call-to-nsurlsession

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!