1
我認爲這是一個非常糟糕的方式來檢查用戶對資源的訪問。有沒有快速的方法來檢查使用ALAssetsLibrary的用戶訪問?
有沒有更好的方式獲得用戶訪問?
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];
爲什麼你認爲這是一個糟糕的方式檢查訪問?我在問,因爲這會幫助我們提供合適的答案。 – sosborn 2012-05-02 22:28:42