Satyam
Satyam

Reputation: 15894

Checking permission before using UIImagePickerController

One of my earlier version of iOS app uses UIImagePickerController. During that development period there's no permissions involved to access the photos/videos from album. But in latest version, it asks for permission of user to access album.
How can I check if the user has granted permission for accessing the photo album on the device with the help of UIImagePickerController (not using ALAssetLibrary)?

Upvotes: 10

Views: 1977

Answers (1)

ianyh
ianyh

Reputation: 619

Update:

Since the PhotoKit framework was introduced in iOS 8 the best way to determine status is on PHPhotoLibrary.

Objective-C:

[PHPhotoLibrary authorizationStatus];

Swift:

PHPhotoLibrary.authorizationStatus()

There isn't anything in the public interface for UIImagePickerController that could be used to determine photo data authorization status. Alas, it seems the only option for determining authorization status is +[ALAssetsLibrary authorizationStatus].

Upvotes: 10

Related Questions