Crashes in PHPickerViewController PFAssertionPolicyAbort

Hello!

I'm getting crash reports in PHPickerViewController for iOS 17 users only. Can someone point me into the right direction what could be the root cause in my case since it's related to PHPickerViewController?

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001e7e9342c __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001fbc32c0c pthread_kill + 268 (pthread.c:1721)
2   libsystem_c.dylib             	0x00000001a6d36ba0 abort + 180 (abort.c:118)
3   PhotoFoundation               	0x00000001d2420280 -[PFAssertionPolicyAbort notifyAssertion:] + 68 (PFAssert.m:432)
4   PhotoFoundation               	0x00000001d2420068 -[PFAssertionPolicyComposite notifyAssertion:] + 160 (PFAssert.m:259)
5   PhotoFoundation               	0x00000001d242061c -[PFAssertionPolicyUnique notifyAssertion:] + 176 (PFAssert.m:292)
6   PhotoFoundation               	0x00000001d241f7f4 -[PFAssertionHandler handleFailureInFunction:file:lineNumber:description:arguments:] + 140 (PFAssert.m:169)
7   PhotoFoundation               	0x00000001d2420c74 _PFAssertFailHandler + 148 (PFAssert.m:127)
8   PhotosUI                      	0x0000000216b59e30 -[PHPickerViewController _handleRemoteViewControllerConnection:extension:extensionRequestIdentifier:error:completionHandler:] + 1356 (PHPicker.m:1502)
9   PhotosUI                      	0x0000000216b5a954 __66-[PHPickerViewController _setupExtension:error:completionHandler:]_block_invoke_3 + 52 (PHPicker.m:1454)

The assert should not fail and we can't reproduce this issue ourselves.

Please double check if you have any code or dependencies extending or swizzling system classes (e.g. NSObject / NSExtensionContext) that can alter their default behaviors.

It would be great if you can share a sample project so we can further investigate this issue.

Thank you @Engineer!

We were able to resolve the issue (in SwiftUI). The error was caused by presenting the PHPickerViewControllerRepresentable on an adaptiveSheetPresentationController that sometimes lead to the issue. We just had to remove the adaptiveSheetPresentationController and use a fullScreenCover instead. This fixed the issue.

Crashes in PHPickerViewController PFAssertionPolicyAbort
 
 
Q