XCUITest "MyApp" Would Like to Access Your Photo Library

I can't work out how to deal with the dialog presented when an app first tries to access a photo library:

This screenshot shows the dialog still presented after the app has quit, which suggests to me that it's a system-level rather than app-level dialog; but the handler for addUIInterruptionMonitor(withDescription:handler:) isn't called (whereas it is for both the "Allow MyApp to use your location?" and "MyApp Would Like to Send You Notifications" dialogs). But nor does it appear to be an app-level dialog under XCUIApplication.

How can I handle this dialog in my UI testing?

Thanks, Hamish