react-native-image-picker: App Crashes after photo selection (iOS 13)
Bug
- Click on Choose Photo (iOS Simulator (iOS 13))
- Select Photo
- App crashes
Is this possible a permissions issue? I’m able to select the photo, but then the app crashes immediately after that and console.log(response) logs undefined
Environment info
OS
iOS 13
System
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 4.05 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.9.1 - /usr/local/bin/node
npm: 6.10.2 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Libraries:
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-image-picker": "^1.1.0",
Steps To Reproduce
- Click on Choose Photo (iOS Simulator)
- Select Photo
- App crashes
Reproducible sample code
addPhoto = () => {
try {
// Image Picker
ImagePicker.showImagePicker(response => {
console.log(response);
});
}
catch (error) {
console.log(error);
}
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 30
i am still facing this issue after adding these permission in info.list @sgimmai
@jefelewis here’s mine
I resolved this issue successfully. You can add some value below to info.plist <key>NSPhotoLibraryUsageDescription</key> <string>$(PRODUCT_NAME) would like access to your photo gallery</string> <key>NSCameraUsageDescription</key> <string>$(PRODUCT_NAME) would like to use your camera</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string> <key>NSMicrophoneUsageDescription</key> <string>$(PRODUCT_NAME) would like to use your microphone (for videos)</string>
+1, Not stale - still an issue
Adding the permissions for both iOS and Android fixed it for me.
Hello all,
As per above recommendation you have to do following:
Open Info.plist located in ios/{NAME_OF_YOUR_PROJECT}/Info.plist
Add following keys related to PhotoLibrary usage:
<key>NSPhotoLibraryAddUsageDescription</key> <string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string> <key>NSPhotoLibraryUsageDescription</key> <string>$(PRODUCT_NAME) would like access to your photo gallery</string> <key>NSLocationWhenInUseUsageDescription</key>
Example:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSCameraUsageDescription</key> <string>$(PRODUCT_NAME) would like to use your camera</string> <key>NSMicrophoneUsageDescription</key> <string>$(PRODUCT_NAME) would like to use your microphone (for videos)</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string> <key>NSPhotoLibraryUsageDescription</key> <string>$(PRODUCT_NAME) would like access to your photo gallery</string> </dict>IOS 13, Iphone 11 simulator
BR, Zhi
If the app is crashing after choosing a photo from iOS simulator gallery, I suppose it is caused because is a high quality image and there is a limit… when my app crashes, this “error” appears in Xcode: libsystem_kernel.dylib`__abort_with_payload:
I don’t know if it makes sense…
The app is still crashing after the photo selection and with the items added to info.plst as the following. Are you on iOS 13?