i am trying to access videos in iPhone library using AssetsLibrary Framework with the help of following code...but when i run the application the code is not working...the array assets is still empty?? what am i doing wrong??
btw my iPhone is a 3G upgraded to iPhone 4.1.(but assets framework is not giving any error)
NSMutableArray *assets = [[NSMutableArray alloc]init];
ALAssetsLibrary *library =[[ALAssetsLibrary alloc]init];
void (^assetEnumerator)(struct ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
if(result != NULL) {
NSLog(@"See Asset: %@", result);
[assets addObject:result];
}
};
void (^assetGroupEnumerator)(struct ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) {
if(group != nil) {NSLog(@"dont See Asset: ");
[group enumerateAssetsUsingBlock:assetEnumerator];
}
};
assets = [[NSMutableArray alloc] init];
library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAlbum
usingBlock:assetGroupEnumerator
failureBlock: ^(NSError *error) {
NSLog(@"Failure");
}];