使用ALAssertLibrary获取系统相册

 
 
 
 
 
 
使用ALAssertLibrary必须要开启系统定位,  先判断是否可以使用


	
	_isCanReadALAsset = YES;
 
    
       void (^assetGroupEnumerator)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) 
	{
		
	};
	
	// Group Enumerator Failure Block
	void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) 
	{
		_isCanReadALAsset = NO;
	};
	
	// Enumerate Albums
	
	ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];   
	if(library == nil)
	{
		_isCanReadALAsset = NO;
	}
	else
	{
		[library enumerateGroupsWithTypes:ALAssetsGroupAll
							   usingBlock:assetGroupEnumerator 
							 failureBlock:assetGroupEnumberatorFailure];
		
	}
	
	[library release];




你可能感兴趣的:(使用ALAssertLibrary获取系统相册)