I’m using the AlAssetLibrary class for retrieve informations about the images inside my iPad. As you can see actually i have found the pixel width of the asset. What i need to find now is the name of the album for each asset. So if all assets are in the “camera” album i need to find it for each asset. How can i proceed? Here there is my code. Please note the NSString assetAlbumName. It is returning to me an error.
[library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
if (group) {
[group setAssetsFilter:[ALAssetsFilter allPhotos]]; //search for the photos
[group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop){
if (asset){
NSNumber *width = [[[asset defaultRepresentation] metadata] objectForKey:@"PixelWidth"]; //find the key with "PixelWidth" name
NSString *widthString = [NSString stringWithFormat:@"%@", width]; //take the value of the key
NSString *assetAlbumName = [asset valueForProperty:ALAssetsGroupPropertyName]; //it return to me an ALErrorInvalidProperty
}
}
}
}
Thanks
you may try
NSString *albumName = [group valueForProperty:ALAssetsGroupPropertyName];
you are doing
NSString *albumName = [assets valueForProperty:ALAssetsGroupPropertyName];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With