PHPhotoLibrary.authorizationStatus and .addOnly

For our app, we now use the new PHPickerViewController for selecting photos for profile and sharing, and we do not need to prompt the user for permission as we do not use PhotoKit or PHAssets. This is good.

However, when saving a photo to the camera roll taken with the camera via UIImagePickerController,  we request .addOnly permission. 

 let status = PHPhotoLibrary.authorizationStatus(for: .addOnly)

 if status != .authorized {

            PHPhotoLibrary.requestAuthorization({status in

                DispatchQueue.main.async { …

When the user is prompted for Photos access we get still the normal alert with Select Photos…, Allow Access to All Photos, Don’t Allow.

If the user took the photo with the camera in our application, it seems that permission is explicit and why would we need the prompt the user to Select Photos… when we are just adding a photo the user took to the camera roll? This is confusing to the user, as they would be selecting photos for what purpose..?  In light of this, what is the difference or advantage in requesting authorization for .addOnly as opposed to .readWrite ? We still get the prompt as if access were needed for other than .addOnly. 

Accepted Answer

Can you confirm that your app has an NSPhotoLibraryAddUsageDescription key (note this is different than the NSPhotoLibraryUsageDescription key)? You will need an AddUsage key in order to prompt the user for add only authorization.

https://developer.apple.com/documentation/bundleresources/information_property_list/nsphotolibraryaddusagedescription?language=objc

Additionally it'd be good to move to the new apis that handle the Limited Library APIs better, more details here: https://developer.apple.com/documentation/photokit/delivering_an_enhanced_privacy_experience_in_your_photos_app?language=objc

Can you confirm that your app has an NSPhotoLibraryAddUsageDescription key (note this is different than the NSPhotoLibraryUsageDescription key)? You will need an AddUsage key in order to prompt the user for add only authorization.

Thank you for your prompt response. You guys at Apple are really on the ball and awesome! Your response gave me the heads up to completely solve the issue! The key NSPhotoLibraryAddUsageDescription was present in the plist. But, as you pointed out, I needed to move to the new api for requesting permission. I was querying for permission with PHPhotoLibrary.authorizationStatus(for: .addOnly), which was good. But for requesting it needed to be PHPhotoLibrary.requestAuthorization(for: .addOnly)  instead of PHPhotoLibrary.requestAuthorization({ status in… Which now is obvious. Now everything works as expected and the prompt for .addOnly shows with:  “Our App” Would Like to Add to your Photos. Thanks again

PHPhotoLibrary.authorizationStatus and .addOnly
 
 
Q