image_picker crashes when picking images on simulator running on Apple Silicon M1

Viewed 849

On an Apple Silicon M1 it is not possible to select the UIImagePicker controller to select an image. In the photo gallery, when you click on the image, the interface does nothing and does not react anything.To exit the interface you must click on the cancel button, but unfortunately it doesn't work also.It's working fine in real device device or intel processor mac simulator with same code and same iOS version.

Currently I am testing on below configuration

System OS: macOS Bigsur(11.2.2)  
chip: Apple M1 
iOS Simulator: iPhone11(iOS 14.4)
xCode:12.0.4

I get exception like below when i try to select image

<NSXPCConnection: 0x60000016a080> connection on anonymousListener or serviceListener from pid 17615: Warning: Exception caught during invocation of selector didSelectMediaWithInfoDictionary:, dropping incoming message and invalidating the connection.
Exception: *** -[NSURL URLByAppendingPathExtension:]: component, components, or pathExtension cannot be nil.
*** -[NSURL URLByAppendingPathExtension:]: component, components, or pathExtension cannot be nil.
(
    0   CoreFoundation                      0x00007fff20421af6 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff20177e78 objc_exception_throw + 48
    2   Foundation                          0x00007fff20860900 -[NSURL(NSURLPathUtilities) URLByDeletingPathExtension] + 0
    3   PhotosUI                            0x00007fff3faf656a -[PUPhotoPickerExtensionHostContext _UIImagePickerControllerInfoDictionaryFromPhotoPickerInfoDictionary:] + 2177
    4   PhotosUI                            0x00007fff3faf5b5b -[PUPhotoPickerExtensionHostContext didSelectMediaWithInfoDictionary:] + 34
    5   Foundation                          0x00007fff209290e3 __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S1__ + 10
    6   Foundation                          0x00007fff20927e1b -[NSXPCConnection _decodeAndInvokeMessageWithEvent:flags:] + 2268
    7   Foundation                          0x00007fff20929412 message_handler + 206
    8   libxpc.dylib                        0x00007fff20055cac _xpc_connection_call_event_handler + 56
    9   libxpc.dylib                        0x00007fff2005603e _xpc_connection_mach_event + 905
    10  libdispatch.dylib                   0x000000010c73ba68 _dispatch_client_callout4 + 9
    11  libdispatch.dylib                   0x000000010c755ba8 _dispatch_mach_msg_invoke + 550
    12  libdispatch.dylib                   0x000000010c7420ad _dispatch_lane_serial_drain + 307
    13  libdispatch.dylib                   0x000000010c756a76 _dispatch_mach_invoke + 563
    14  libdispatch.dylib                   0x000000010c7420ad _dispatch_lane_serial_drain + 307
    15  libdispatch.dylib                   0x000000010c742f9d _dispatch_lane_invoke + 493
    16  libdispatch.dylib                   0x000000010c74ede2 _dispatch_workloop_worker_thread + 882
    17  libsystem_pthread.dylib             0x00007fff61167499 _pthread_wqthread + 314
    18  libsystem_pthread.dylib             0x00007fff61166467 start_wqthread + 15
)

Eager for this to be fixed out, it is really unbelievable issue. Kindly help me to solve this.

1 Answers

I was just able to fix this problem. I'm on an M1 Macbook Air.

I upgraded to Monterey, but that didn't fix it. Then I installed Xcode 13, which uses iPhone 13 as the default phone for emulation, and it started working. I'm not sure if it was the Xcode upgrade or using the iPhone 13 that did the trick.

Related