Home > DeveloperSection > Interviews > What is the use of authorizationStatus in ALAssetsLibrary?

Posted on    December-17-2015 7:30 AM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  384  View(s)
Rate this:

Tarun Kumar

Total Post:107

Posted on    December-17-2015 8:30 AM

authorizationStatus is a contant of ALAssetsLibrary, it will checks whether the user of application has provided access to the application to access the Assets or not. In case not then it shows up a alert to the end user to enable manually via Settings. One thing to remember there is no way you can change the settings through your app programatically. So this has to be done manually as its upto end user to allow access to Assets for the particular application.
Its example is here:

if([ALAssetsLibrary authorizationStatus]) {
  //Library Access code goes here
else {
  UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Permission Denied" message:@"Please allow the application to access your photo and videos in settings panel of your device" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
  [alertView show];

Don't want to miss updates? Please click the below button!

Follow MindStick