Picker failed with error

Hello,

I am trying to display the new PHPickerViewController in my app, but it crashes whenever the "cancel" or "done" button are pressed.

The strange thing is, I cannot reproduce the crash with a brand new project. It's crashing for only one of the projects and not for the others. The code was exactly the same for every project I tried it with.

Has anyone run into the same problem?

Details below.

From Xcode console:

2020-10-24 09:42:35.254812+0200 <projectname>[46747:872367] [Picker] Picker failed with error: Error Domain=PXErrorDomain Code=-1 "PHPickerViewController did timeout." UserInfo={NSDebugDescription=PHPickerViewController did timeout.}


Stack trace:

Exception Type: EXC
BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000191b87ee0
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [9798]
Triggered by Thread: 0

Application Specific Information:
size unreasonably big

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreFoundation 0x0000000191b87ee0 _NSArrayMnew.cold.1 + 16
1 CoreFoundation 0x0000000191a4280c _NSArrayMtransferNew + 0
2 CoreFoundation 0x0000000191a0ec50 +[NSMutableArray arrayWithCapacity:] + 36
3 PhotosUICore 0x00000001a3c6ffd0 PXMap + 160
4 PhotosUI 0x00000001a353d070 -[PHPickerViewController pickerDidFinishPicking:] + 264
5 PhotosUI 0x00000001a3517108 -[PUPickerRemoteUIViewController
pickerDidFinishPicking:] + 80
6 CoreFoundation 0x0000000191b24870 invoking + 144
7 CoreFoundation 0x0000000191a07fd0 -[NSInvocation invoke] + 300
8 libdispatch.dylib 0x0000000191759280
dispatchclientcallout + 16
9 libdispatch.dylib 0x00000001916feb0c dispatchblockinvokedirect$VARIANT$mp + 224
10 FrontBoardServices 0x00000001a03eb4b8 FBSSERIALQUEUEISCALLINGOUTTOABLOCK + 40
11 FrontBoardServices 0x00000001a03eb180 -[FBSSerialQueue targetQueueperformNextIfPossible] + 404
12 FrontBoardServices 0x00000001a03eb654 -[FBSSerialQueue performNextFromRunLoopSource] + 28
13 CoreFoundation 0x0000000191aa0240 CFRUNLOOP
ISCALLINGOUTTOASOURCE0PERFORMFUNCTION + 24
14 CoreFoundation 0x0000000191aa0140
CFRunLoopDoSource0 + 204
15 CoreFoundation 0x0000000191a9f488
CFRunLoopDoSources0 + 256
16 CoreFoundation 0x0000000191a99a40
CFRunLoopRun + 776
17 CoreFoundation 0x0000000191a99200 CFRunLoopRunSpecific + 572
18 GraphicsServices 0x00000001a7b94598 GSEventRunModal + 160
19 UIKitCore 0x000000019435f004 -[UIApplication
run] + 1052
20 UIKitCore 0x00000001943645d8 UIApplicationMain + 164
21 <app_name> 0x00000001023c361c main + 144924 (main.m:14)
22 libdyld.dylib 0x0000000191778598 start + 4

Code:
Code Block
var configuration = PHPickerConfiguration()
configuration.selectionLimit = selectionLimit // evaluates to 6 during runtime
configuration.filter = .images
let picker = PHPickerViewController(configuration: configuration)
picker.delegate = self
picker.modalPresentationStyle = .fullScreen
present(picker, animated: true)
Answered by Engineer in 646377022
We don't have enough information from the stack trace. Feel free to file a feedback request with a reproducible project so we can further investigate.

You can also check if your project has any special NSArray/NSMutableArray extensions that might cause this problem.
Accepted Answer
We don't have enough information from the stack trace. Feel free to file a feedback request with a reproducible project so we can further investigate.

You can also check if your project has any special NSArray/NSMutableArray extensions that might cause this problem.
Removing an extension that modifies the default behaviour of NSArray solved the problem. The extension was introduced by a third party library.

Thank you Frameworks Engineer!
Picker failed with error
 
 
Q