PHPickerViewController crashing with _PFAssertFailHandler

Hello, we are embedding a PHPickerViewController with UIKit (adding the vc as a child vc, embedding the view, calling didMoveToParent) in our app using the compact mode. We are disabling the following capabilities .collectionNavigation, .selectionActions, .search.

One of our users using iOS 17.2.1 and iPhone 12 encountered a crash with the following stacktrace:

Crashed: com.apple.main-thread
0  libsystem_kernel.dylib         0x9fbc __pthread_kill + 8
1  libsystem_pthread.dylib        0x5680 pthread_kill + 268
2  libsystem_c.dylib              0x75b90 abort + 180
3  PhotoFoundation                0x33b0 -[PFAssertionPolicyCrashReport notifyAssertion:] + 66
4  PhotoFoundation                0x3198 -[PFAssertionPolicyComposite notifyAssertion:] + 160
5  PhotoFoundation                0x374c -[PFAssertionPolicyUnique notifyAssertion:] + 176
6  PhotoFoundation                0x2924 -[PFAssertionHandler handleFailureInFunction:file:lineNumber:description:arguments:] + 140
7  PhotoFoundation                0x3da4 _PFAssertFailHandler + 148
8  PhotosUI                       0x22050 -[PHPickerViewController _handleRemoteViewControllerConnection:extension:extensionRequestIdentifier:error:completionHandler:] + 1356
9  PhotosUI                       0x22b74 __66-[PHPickerViewController _setupExtension:error:completionHandler:]_block_invoke_3 + 52
10 libdispatch.dylib              0x26a8 _dispatch_call_block_and_release + 32
11 libdispatch.dylib              0x4300 _dispatch_client_callout + 20
12 libdispatch.dylib              0x12998 _dispatch_main_queue_drain + 984
13 libdispatch.dylib              0x125b0 _dispatch_main_queue_callback_4CF + 44
14 CoreFoundation                 0x3701c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
15 CoreFoundation                 0x33d28 __CFRunLoopRun + 1996
16 CoreFoundation                 0x33478 CFRunLoopRunSpecific + 608
17 GraphicsServices               0x34f8 GSEventRunModal + 164
18 UIKitCore                      0x22c62c -[UIApplication _run] + 888
19 UIKitCore                      0x22bc68 UIApplicationMain + 340
20 WorkAngel                      0x8060 main + 20 (main.m:20)
21 ???                            0x1bd62adcc (Missing)

Please share if you have any ideas as to what might have caused that, or what to look at in such a case. I haven't been able to reproduce this myself unfortunately.

We've also faced this assertion recently

Assertion failure in -[PHPickerViewController _handleRemoteViewControllerConnection:extension:extensionRequestIdentifier:error:completionHandler:], /Library/Caches/com.apple.xbs/Sources/Photos_UI/Projects/PhotosUI/PhotosUI/macOS+iOS/PHPicker/PHPicker.m:1489 [extension _extensionContextForUUID:PFAssertClass(extensionRequestIdentifier, NSUUID)] should be an instance inheriting from PUPickerExtensionHostContext, but it is nil

If someone has knows what this might indicate, or whether this is a bug in the framework please reply

Did you find the root cause, @evilmint45? I'm also facing this issue: https://forums.developer.apple.com/forums/thread/763520

PHPickerViewController crashing with _PFAssertFailHandler
 
 
Q