B.S.
B.S.

Reputation: 21726

Is there quick way to check user access using ALAssetsLibrary?

I think this is a really bad way to check user access to the resources.

Is there better way to get user access?

    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
   // create library

    ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
    {
        accessGiven = YES;
        return ;       
    };
    void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) { 
        accessGiven =  NO;
        return;
    };  

   // create 2 blocks 

    NSURL *url = [[NSURL alloc] initWithString:@" "];
    [library assetForURL:url resultBlock:resultblock failureBlock:assetGroupEnumberatorFailure]; 
  // use empty url to check acces..

    [library release];

Upvotes: 1

Views: 755

Answers (1)

B.S.
B.S.

Reputation: 21726

iOS 6.0 has better way to do that.

[ALAssetsLibrary authorizationStatus];

Method Description

Authorization Status Enum

Upvotes: 1

Related Questions