Ich habe überall gesucht, konnte aber keine Antwort darauf finden.IOS Photo Library holen Sie den Albumnamen für ein gegebenes Foto
In IOS PhotosFramework, wie nehme ich ein Bild/PHAsset und finde heraus, welchen Sammlungen/Alben es zugeordnet ist?
Ich weiß bereits, wie man eine Liste aller Alben von dort bekommt, ich kann auch alle Bilder in jedem Album bekommen. Aber wie mache ich das anders herum - d. H. Für einen bestimmten PHAsset, wie man den Namen von Album/Collections erhält, die ihm zugewiesen sind.
Hier ist der Code ich eine Liste aller Alben in Camera Roll bekommen haben:
-(void) listAllAlbums{
PHFetchOptions *userAlbumsOptions = [PHFetchOptions new];
userAlbumsOptions.predicate = [NSPredicate predicateWithFormat:@"estimatedAssetCount > 0"];
PHFetchResult *userAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:userAlbumsOptions];
NSLog(@"--------- entered %s ------------- ", __PRETTY_FUNCTION__);
[userAlbums enumerateObjectsUsingBlock:^(PHAssetCollection *collection, NSUInteger idx, BOOL *stop) {
NSLog(@"album title %@", collection.localizedTitle);
}];
NSLog(@"--------- end of %s ------------- ", __PRETTY_FUNCTION__);
}
Dank
Dank Rickster! Genau das habe ich gebraucht. schätze deine Hilfe. – Pankaj