Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
735 stars 335 forks source link

[iOS] [Debug] App crashing as soon as upload starts #122

Closed BaderSerhan closed 5 years ago

BaderSerhan commented 5 years ago

I'm getting the following error as soon as I try uploading something in debug mode:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must override the supportedEvents method of fir_0x600000393c00_VydiaRNFileUploader'

In release mode, it is working just fine!

I looked in the class, and the supportedEvents method seems to be overrode.

Here's the supportedEvents method:

 - (NSArray<NSString *> *)supportedEvents {
    return @[
        @"RNFileUploader-progress",
        @"RNFileUploader-error",
        @"RNFileUploader-cancelled",
        @"RNFileUploader-completed"
    ];
}

And here's where the crash is happening in XCode: _urlSession = [NSURLSession sessionWithConfiguration:sessionConfiguration delegate:self delegateQueue:nil];

TSMMark commented 5 years ago

Thanks for the report. Are you able to reproduce the issue in a fork of the RNBU example app?

berkcoker commented 5 years ago

I've noticed that this only happens on Debug mode, but is fine on Release

alexivison commented 5 years ago

I'm also having the same problem... Any movement on this ?

BaderSerhan commented 5 years ago

@TSMMark I tried it on the RNBU example app, and it is working fine. I think it is a conflict with react-native-firebase because this issue started appearing when I integrated Firebase. It is affecting all of my logic and now the app is nearly non-functional because of this :/.

@berkcoker @alexivison Can you confirm if you have firebase integrated?

BaderSerhan commented 5 years ago

I just removed Firebase/Performance from the pods

Removing FirebaseABTesting
Removing FirebasePerformance
Removing FirebaseRemoteConfig
Removing GoogleToolboxForMac

And the crash stops! I don't know which one exactly was causing the conflict, but I think this solves it for now and we can move on with our lives.

TSMMark commented 5 years ago

Glad to hear that @BaderSerhan! Thanks for update

Shervanator commented 5 years ago

I'm still having this issue in Debug mode, did anyone have any clues/ideas? Other projects have also had this issue: https://github.com/WebEngage/react-native-webengage/issues/1

BaderSerhan commented 5 years ago

@Shervanator Do you have firebase integrated? Because it seems to be an issue with the method swizzling. Try removing Firebase/Performance and see if it persists.

Shervanator commented 5 years ago

yep! firebase performance analytics is definitely causing the issues. I have removed it for the moment, but it is a super common library, so it would be cool to figure out why its not working as well!

pribeh commented 5 years ago

same here. removing firebase performance resolves the issue

Jarred-Sumner commented 4 years ago
[FIRPerformance sharedInstance].dataCollectionEnabled = false;
[FIRPerformance sharedInstance].instrumentationEnabled = false;

This will disable it if you don't want to remove it just yet. Can stick that code into your AppDelegate.

leow93 commented 4 years ago

This is still an issue it seems, but @Jarred-Sumner 's fix works nicely - thanks for that! You can even do:

#if DEBUG
  [FIRPerformance sharedInstance].dataCollectionEnabled = false;
  [FIRPerformance sharedInstance].instrumentationEnabled = false;
#endif

so that you don't lose the firebase performance tools for release mode :)