Tell us which versions you are using:
"react-native-image-crop-picker": "0.21.2",
"react-native": "0.56.0",
Related to IOS. It is working fine in android. But crashing on ios. I added permission Info.plist.
Code
```openCamera(){
this.setState({modalVisible:false}, () =>
setTimeout(() =>
ImagePicker.openCamera({
mediaType: "photo",
compressImageQuality:0.7
}).then( img => {
img.uri = img.path;
this.uploadImage( img );
//this.setState({ images: [...this.state.images, img] } );
})
,500));
}
uploadImage( response ){
this.setState({isLoaderVisible:true});
let source = { uri: response.uri };
let fileName = response.uri.replace(/^.*[\\\/]/, '');
RNFetchBlob.fetch('POST', Constants.url+'/upload_to_images', {
'Content-Type': 'multipart/form-data',
}, [
{ name: 'auth_token', data : this.state.auth_token },
{ name: 'user_id' , data: this.state.user_id },
{ name: 'photo', filename: fileName, data: RNFetchBlob.wrap(response.uri) },
]).then((res) => {
let json = res.json();
if( json.status == 'SUCCESS' ){
let gallery_id = json.gallery_id;
let n = this.state.images.length;
let source = { uri: response.uri, key:n, gallery_id: gallery_id };
this.setState({
isLoaderVisible:false,
images: [...this.state.images, source]
});
}
})
.catch((err) => {
this.setState({isLoaderVisible:false});
alert('Sorry.. not uploaded')
});
}```
Here too
I followed the install instruction and tried both react-native link and Cocoapods ways, then ran it with react-native run-ios, the app crashed without any error report. But running from Xcode everything is just fine. This almost killed me.
Lucky me, Just amount ago, I tried this way, it worked!
RSKImageCropper.framework and QMImagePicker.framework. You can have a try, maybe it also works for you.
@arshidkv12 @mayconmesquita
I am also facing the same issue, any idea why this is happening?
I followed the install instruction and tried both
react-native linkandCocoapodsways, then ran it withreact-native run-ios, the app crashed without any error report. But running from Xcode everything is just fine. This almost killed me.Lucky me, Just amount ago, I tried this way, it worked!
1. npm i react-native-image-crop-picker --save 2. react-native link react-native-image-crop-picker 3. open iOS project in Xcode 4. Project - Targets - General - Embedded Binaries, press "+" to add `RSKImageCropper.framework` and `QMImagePicker.framework`. 5. react-native run-iosYou can have a try, maybe it also works for you.
@arshidkv12 @mayconmesquita
Not working ...
I was getting the same issue, I wasn't getting any stack trace from React-Native, the app was simply crashing.
However, in my Xcode logs i found this:
[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
Adding Privacy - Camera Usage Description with a short description to info.plist solved the issue for me
Hope this helps someone!
Ok. This is the solution that worked for me:
Unlink this package:
react-native unlink react-native-image-crop-picker
Remove build folder from ios (Be careful):
rm -rf ios/build
Import this line to your podfile:
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
Link this package again with link command:
react-native link react-native-image-crop-picker
And in your ios folder:
pod update
pod install
And run your app from xcode.
@runryan, I just added the step 4 then I run the project from xcode and my app works well and not crashing, but when I run it in to my ios device didn't work and is crashed
cannot reproduce this issue. please make sure that you followed installation steps from readme
Most helpful comment
Not working ...