Reputation: 179
I have an application that should save a picture to the Photo library if permission is granted and if not, it should write to another folder in the app sandbox. I do not need read access on the photo library, so I tried adding the NSPhotoLibraryAddUsageDescription in the info.plist and it works but I can't find out if and what the user has selected. I have found
PHAuthorizationStatus authStatus = [PHPhotoLibrary authorizationStatus];
for checking the status, but it seems there isn't a PHAuthorizationStatus
to signal the add-Photo authorization status. I always get PHAuthorizationStatusNotDetermined
for both settings, denied and consented.
Is there a known workaround? Did I miss an API call for determining the add-Photo-auth-status?
Upvotes: 0
Views: 411
Reputation: 534885
You're correct. If all you're going to do is add a photo to the library using UIImageWriteToSavedPhotosAlbum, the way to find out if the user denied you access is that you'll get that as an error in the completion handler. (That's because this very crude way of adding a photo to the library predates the whole Photos framework.)
Upvotes: 3