WHAT IS THE USE OF AUTHORIZATIONSTATUS IN ALASSETSLIBRARY?

Tarun Kumar

Total Post:107

Points:535
Posted by  Tarun Kumar
 633  View(s)
Ratings:
Rate this:
  1. Tarun Kumar

    Post:107

    Points:535
    What is the use of authorizationStatus in ALAssetsLibrary?

    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];
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!