Hello! The bug is only present on iOS, when I try to upload an image or video, 1 in 5 times this crash appears!
static uploadImage = (path, uri, imageName) => new Promise(async (accept, reject) => {
try {
const response = await fetch(uri);
const blob = await response.blob();
const upRef = await firebase
.storage()
.ref()
.child(path + imageName)
const snapshot = await upRef.put(blob)
snapshot.ref.getDownloadURL().then(downloadURL => {
accept(downloadURL)
});
}
catch(e) {
reject()
}
})
I use react-native-image-picker!
Describe your issue here
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
target 'project' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'Branch'
pod 'Firebase'
#pod 'Firebase/InAppMessagingDisplay'
pod 'Firebase/Auth'#, '~> 5.4.1'
pod 'Firebase/Core', '~> 5.15.0'
pod 'Firebase/DynamicLinks'#, '~> 3.4.2'
pod 'Firebase/Messaging'#, '~> 3.4.0'
pod 'Firebase/Functions'#, '~> 2.4.0'
pod 'Fabric', '~> 1.7.13'
pod 'Crashlytics', '~> 3.10.7'
#### `AppDelegate.m`:
// N/A
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:
// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->
Click To Expand
**`react-native info` output:**
React Native Environment Info:
System:
OS: macOS 10.15
CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
Memory: 263.04 MB / 16.00 GB
Shell: 3.2.57 - /bin/sh
Binaries:
Node: 11.0.0 - /usr/local/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.5 => 16.8.5
react-native: ~0.59.4 => 0.59.5
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
- **Platform that you're experiencing the issue on**:
- [x] iOS
- [ ] Android
- [ ] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`react-native-firebase` version you're using that has this issue:**
- `e.g. 5.4.3`
- **`Firebase` module(s) you're using that has the issue:**
- `e.g. Instance ID`
- **Are you using `TypeScript`?**
- `Y/N`
Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]
React Native Firebase and Invertase on Twitter for updates on the library.This problem was the bane of my existence for quite a while. It seems that the react-native blob manager sometimes gets ahead of itself before the content is actually ready. I solved it by adding one line:
[NSThread sleepForTimeInterval:1.0f];
in node_modules/react-native/Libraries/Blob/RCTBlobManager.mm
Whole section below for reference:
`// @lint-ignore FBOBJCUNTYPEDCOLLECTION1
NSDictionary *blob = [RCTConvert NSDictionary:data[@"blob"]];
NSString *contentType = @"application/octet-stream";
NSString *blobType = [RCTConvert NSString:blob[@"type"]];
if (blobType != nil && blobType.length > 0) {
contentType = blob[@"type"];
}
return @{@"body": [self resolve:blob], @"contentType": contentType};
}`
Pods super old on the original report, they are on 6.7.0 now, I wonder if this is a bug in the underlying SDK and has been fixed now? @ami9000 are you on the current firebase ios sdk release, and still seeing this?
Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Going to close this one as it looks like it's an RN issue as @ami9000 mentioned above - probably worth reporting this on the RN repo as well
Most helpful comment
This problem was the bane of my existence for quite a while. It seems that the react-native blob manager sometimes gets ahead of itself before the content is actually ready. I solved it by adding one line:
[NSThread sleepForTimeInterval:1.0f];in node_modules/react-native/Libraries/Blob/RCTBlobManager.mm
Whole section below for reference:
`// @lint-ignore FBOBJCUNTYPEDCOLLECTION1
{
// @lint-ignore FBOBJCUNTYPEDCOLLECTION1
[NSThread sleepForTimeInterval:1.0f];
NSDictionary *blob = [RCTConvert NSDictionary:data[@"blob"]];
NSString *contentType = @"application/octet-stream";
NSString *blobType = [RCTConvert NSString:blob[@"type"]];
if (blobType != nil && blobType.length > 0) {
contentType = blob[@"type"];
}
return @{@"body": [self resolve:blob], @"contentType": contentType};
}`