react-native-image-crop-picker
react-native-image-crop-picker copied to clipboard
Terminating app due to uncaught exception 'NSGenericException'
Version
- react-native-image-crop-picker v0.37.3
- react-native v0.67.4
Platform
- iOS ( iPad )
- System Version: 15.3.1
Actual behaviour
Application crashed.
Attachments
*** Terminating app due to uncaught exception 'NSGenericException' reason:
'Your application has presented a UIAlertController (<UIAlertController: 0x14e809000>) of style UIAlertControllerStyleActionSheet from QBImagePickerController
(<QBImagePickerController: 0x14d233660>).
The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem.
If this information is not known when you present the alert controller you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate
Experiencing the same issue
Steps to reproduce
- Select images from library
- Only give access to a limited photos set
- Click the manage button in iOS photo picker
- App crashes
Version
- react-native-image-crop-picker 0.37.3
- react-native 0.65.2
Platform
- iOS (iPad)
- System version 15.4.1
Code example
import ImageCropPicker, { Image } from 'react-native-image-crop-picker';
ImageCropPicker.openPicker({
multiple: true,
includeExif: true,
forceJpg: true,
maxfiles: 10,
mediaType: 'photo'
}).then((result: Image | Image[]) => {
console.log('Result', result)
}).catch((e) => {
console.error('Error', e);
})
Seems to be fixed in #1753
I have checked now with react-native-image-crop-picker 0.38.0 and it's still crashing on iPad only. on iPhone everything it's working ok.
Was this fixed included in the 0.38.0 build? It is any hack that can be done now?
I have added PhotoUI in the Framework list, but the problem is still here for iPad.
@biskis You can apply the patch, the fix was not included in 0.38.0
patches/react-native-image-crop-picker+0.38.0.patch
diff --git a/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m b/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m
index 859d7b8..dec556c 100644
--- a/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m
+++ b/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m
@@ -281,6 +281,7 @@ - (void)updateControlState
-(void)managePermissionAction:(id)sender
{
UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTableInBundle(@"permission.title", @"QBImagePicker", self.imagePickerController.assetBundle, nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+ actionSheet.popoverPresentationController.sourceView = sender;
[actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTableInBundle(@"permission.cancel", @"QBImagePicker", self.imagePickerController.assetBundle, nil) style:UIAlertActionStyleCancel handler:nil]];
Hi, i am still facing this issue in ios, please help if any one have solved.
"react-native": "0.70.2",
"react-native-image-crop-picker": "^0.38.1",
ios version 16.1
Still facing it.
"react-native": "0.67.4",
"react-native-image-crop-picker": "^0.38.1",
@biskis You can apply the patch, the fix was not included in 0.38.0
patches/react-native-image-crop-picker+0.38.0.patch
diff --git a/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m b/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m index 859d7b8..dec556c 100644 --- a/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m +++ b/node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m @@ -281,6 +281,7 @@ - (void)updateControlState -(void)managePermissionAction:(id)sender { UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTableInBundle(@"permission.title", @"QBImagePicker", self.imagePickerController.assetBundle, nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + actionSheet.popoverPresentationController.sourceView = sender; [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTableInBundle(@"permission.cancel", @"QBImagePicker", self.imagePickerController.assetBundle, nil) style:UIAlertActionStyleCancel handler:nil]];
Doesn't work, just tried on various new iPads
Having the same issue, the patch is not working nor is any new version.
I can confirm that on [email protected]
, the patch works for me. I would recommend that you do the patch yourself instead of trying to copy and paste it.
- Install
patch-package
as a devDependency - Add the single line of code to
node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m
- Run
yarn patch-package react-native-image-crop-picker
. - You'll notice a new file in your
patches/
directory.
can confirm upgrading to the latest version 0.40.0
from 0.39.0
fixed this issue for me