Request photo library authorization popup on macOS Catalyst can't be dismissed

I have an iOS app that I want to publish to the Mac App Store as a Catalyst app, but I noticed a situation where the app can't be closed and has to be force quit.

The problem happens if the user has 0 photos in their Photo Library, and hits "Limited Access" on the request authorization prompt (In my case PHPhotoLibrary.requestAuthorization(for: .readWrite).

Since the popup is a system prompt, I can't manually add a close button to it. I tried wrapping it in a view with a close button but the popup always shows up over any view I'm presenting within my app. If anyone has a workaround that would be greatly appreciated!

Thanks so much for this very interesting post in Catalyst when there are not pictures on the device?

I would love to see the issue myself if you have a simple focused project I can use on a Mac without any image in the library.

Since you cannot wrap or override the system prompt, here are the best workarounds depending on what your app actually needs to do with the Photo Library. I would recommend to use PHPickerViewController If you only need to select photos. If your app requests .readWrite access just so the user can pick photos to upload or edit, you should migrate to PHPickerViewController. It requires zero permissions.

If your app genuinely needs full .readWrite access you can mitigate on macOS, pressing the Esc (Escape) key will often force-dismiss stuck system dialogs and out-of-process Catalyst modals, even when the visual close buttons fail to render.

Let me know if that is possible?

Albert  WWDR

Thanks for the response! Unfortunately my app relies heavily on managing a users photo library, so I can't use PHPickerViewController.

And for some reason esc doesn't work on this system prompt.

I don't know if I can attach a project here, but here is the Feedback ID that contains an attached Xcode Project: FB23624844

Request photo library authorization popup on macOS Catalyst can't be dismissed
 
 
Q