UIImagePickerController inside of a SwiftUI View dismisses the view, rather than firing the callback.

Hello,

When using a UIImagePickerController with the .camera configuration I'm currently facing an issue where the delegate function imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) is not firing. But rather UIKit internals dismisses the parent view to the UIImagePickerController. I'm showing the picker controller through a UIViewControllerRepresentable.

It does not always occur however, and the behavior is very flakey, sometimes it fires when pressing the b, sometimes it does not.

When setting a breakpoint at the dismiss function when pressing the "Use Photo" button, UIKit internals dismisses the view, not my own code.

Hello @farkas,

Thank you for posting this question.

Please provide a link to a minimal focused sample project that reproduces this issue, that way I can investigate it further.

Best regards,

Greg

UIImagePickerController inside of a SwiftUI View dismisses the view, rather than firing the callback.
 
 
Q