ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.12k stars 1.56k forks source link

[QBImagePickerController urlsForAssets:completion:]: unrecognized selector sent to instance causing crashes. #1995

Open brianMxBm opened 11 months ago

brianMxBm commented 11 months ago

Version

Tell us which versions you are using:

Platform

Expected behaviour

Image picker opens -> Selecting any image regardless of the mime type crashes the entire application.

Actual behaviour

Should not crash and images should be returned.

Steps to reproduce

  1. Open the image picker.

  2. Allow access to all images in library.

  3. Results in a crash.

Attachments

Code Example

`export const selectImage = (field: EAssetField, imagePickerResponse: IImagePickerResponse, setImagePickerResponse: (k: IImagePickerResponse) = >void, setErrorMessage: (error: string) = >void) = >{
  ImagePicker.openPicker({
    mediaType: 'any',
  }).then((response) = >{
    handleImageResponse(response, field, imagePickerResponse, setImagePickerResponse);
  }).
  catch((e) = >{
    if (e.code === 'E_NO_CAMERA_PERMISSION') {
      alert('To use Camera, grant Ultraviolet access in Settings');
      setErrorMessage('User did not grant camera permissions');
    }

    if (e.code === 'E_NO_LIBRARY_PERMISSION') {
      alert('To upload from Gallery, grant Ultraviolet access in Settings');
      setErrorMessage('To upload from Gallery, grant Ultraviolet access in Settings');
    }

    if (e.code === 'E_NO_IMAGE_DATA_FOUND') {
      alert('Grant Ultraviolet access in Settings to do that');
      setErrorMessage('Grant Ultraviolet access in Settings to do that');
    }
    return;
  });
};`

-[QBImagePickerController urlsForAssets:completion:]: unrecognized selector sent to instance 0x114008200

Last Exception Backtrace: 0 CoreFoundation 0x18048d89c exceptionPreprocess + 160 1 libobjc.A.dylib 0x18008409c objc_exception_throw + 56 2 CoreFoundation 0x1804a26f8 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0 3 UIKitCore 0x1852e63d4 -[UIResponder doesNotRecognizeSelector:] + 232 4 CoreFoundation 0x1804919f8 __forwarding + 1280 5 CoreFoundation 0x180493d1c _CF_forwarding_prep_0 + 92 6 HelpshiftX 0x106f500a8 -[QBAssetsViewController collectionView:didSelectItemAtIndexPath:] + 812 7 UIKitCore 0x184a0d904 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:deselectPrevious:performCustomSelectionAction:] + 900 8 UIKitCore 0x184a3cdcc -[UICollectionView touchesEnded:withEvent:] + 460 9 UIKitCore 0x1852e540c forwardTouchMethod + 264 10 UIKitCore 0x1852e540c forwardTouchMethod + 264 11 UIKitCore 0x184e01ca8 _UIGestureEnvironmentUpdate + 5912 12 UIKitCore 0x184e002b0 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 288 13 UIKitCore 0x184e00020 -[UIGestureEnvironment _updateForEvent:window:] + 156 14 UIKitCore 0x1852f4a00 -[UIWindow sendEvent:] + 3088 15 UIKitCore 0x1852d468c -[UIApplication sendEvent:] + 576 16 UIKitCore 0x185354014 dispatchPreprocessedEventFromEventQueue + 1708 17 UIKitCore 0x185356ec4 processEventQueue + 5520 18 UIKitCore 0x18534ff58 eventFetcherSourceCallback + 156 19 CoreFoundation 0x1803ee69c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 20 CoreFoundation 0x1803ee5e4 CFRunLoopDoSource0 + 172 21 CoreFoundation 0x1803edd54 CFRunLoopDoSources0 + 232 22 CoreFoundation 0x1803e843c CFRunLoopRun + 768 23 CoreFoundation 0x1803e7d28 CFRunLoopRunSpecific + 572 24 GraphicsServices 0x18e7cdbc0 GSEventRunModal + 160 25 UIKitCore 0x1852bafdc -[UIApplication _run] + 868 26 UIKitCore 0x1852bec54 UIApplicationMain + 124 27 UltravioletUAT 0x100dcc69c main + 96 (main.m:7) 28 dyld_sim 0x1065c5558 start_sim + 20 29 dyld 0x1060c20e0 start + 2360 30 ??? 0x4112000000000000 ???

image

Not exactly sure why this is occurring on every fresh install of my application, I thought it was a caching issue with my build on Xcode but I had uninstalled and cleared all of my xCode data, cleared all of my bundle data, installed on various new devices, and have overall attempted to have a fresh reset. Others are utilizing the same code and a previous version of the image picker package (@0.39.0) and are not encountering the issue. I upgraded due to this issue, #1742 stating it was an issue with permissions. No luck on version 0.40.0 either though. At a loss of what could be the case.

artsiomrf commented 1 week ago

I see the same problem as in my situation: on line 6 of the backtrace is Helpshift. Removing Helpshift eliminates the problem, but it's not a solution. @brianMxBm did you manage to solve it somehow, except removing Helpshift?

P.S. temporal solution is to downgrade Helpshift to version 10.2.3. The problem is that it has the same name of module QBImagePicker in latest version. Not sure how to resolve this issue yet.