Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 205
Satyam Avatar asked Aug 22 '13 01:08

Satyam


1 Answers

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].

like image 134
ianyh Avatar answered Sep 28 '22 07:09

ianyh