tech_human tech_human - 1 year ago 121
iOS Question

Determine if the access to photo library is set or not - iOS 8

With the new functionality is iOS 8.0, if you are using a camera in the app, it will ask for permission to access the camera and then when you try to retake the pic, it asks for permission to access photo library. Next time when I launch the app, I wish to check if the camera and photo library has access permissions to it.

enter image description here

For camera, I check it by

if ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusDenied)
// do something

I am looking for something similar to this for photo library.

Tim Tim
Answer Source

Check +[PHPhotoLibrary authorizationStatus] – if not set, it will return PHAuthorizationStatusNotDetermined. (You can then request access using +requestAuthorization: on the same class.)