Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Swift 4.1 how do you request write-only permission for the photo library?

I have my app requesting permission to add to the photo library but I don't need read access. I see that there is supposed to be an option for this but I can't find how to ask for this access specifically.

I am doing this:

PHPhotoLibrary.requestAuthorization({status in
    if(status == .authorized){
        // save
    }
})

And that works fine, but the request displayed is for full access.

Can I specify that I only need write access? I have both Privacy keys set up in my info.plist

I am running this on a simulator, ios 11.4

like image 443
William Prevett Avatar asked Aug 09 '18 00:08

William Prevett


People also ask

How do I ask for image permission in Swift?

To access the camera in Swift, we first must ask the user for permission. Open up your Info. plist file from your Project Navigator. Then right click and click Add Row .


1 Answers

Unfortunately, access control for PhotoKit is not separated between read and write. If you look at PHAuthorizationStatus, there are only cases where full access is granted. No write only option.

NSPhotoLibraryUsageDescription is the only privacy message you can configure, so you can let the user know that you are only writing, not reading. App store review will make sure that is true.

Edit: also see Detect add photos only permission for iOS 11+

like image 156
Schemetrical Avatar answered Sep 28 '22 15:09

Schemetrical