since iOS 11, in order to gain only Write access you'll need to add the NSPhotoLibraryAddUsageDescription
in your info.plist.
The problem here arises if you want to check if the user allows you to do that. It cannot be done through the [PHPhotoLibrary authorizationStatus]
method, since that calls out the read/write popup (and you'll need to have NSPhotoLibraryUsageDescription
in your info.plist too).
If you want to check if the user gave your app access to write, you'll have to call UIImageWriteToSavedPhotosAlbum
(which I'm guessing you already call if you want to add data to the gallery), and that gives you a callback which tells you if the saving worked or not, but the bigger thing is that it shows the user your NSPhotoLibraryAddUsageDescription
text.
Now, in order to make sure you have access on both, you should add both NSPhotoLibraryAddUsageDescription
and NSPhotoLibraryUsageDescription
added to your info.plist and do your regular check with the PHPhotoLibrary, and if that fails, then you can only check when you want to save the data to the library with UIImageWriteToSavedPhotosAlbum
.
I'd say you can check only with UIImageWriteToSavedPhotosAlbum
but you need to actually save an image to the user gallery to do that and it's hacky, which is a no no.
UIImageWriteToSavedPhotosAlbum
callback as mikebld suggested). It is unfortunate, because I always disabled "Export to Camera Roll" button, if device denied permissions to library. Now I must always show it and return some error alert if export attempt was unsuccessful. – Blanche