Skip to content

Instantly share code, notes, and snippets.

@kwangbae
kwangbae / Tidy_PHAsset
Last active October 16, 2017 07:57
Getting all photos except iCloud sharing photos using PHAsset class.
PHFetchResult* assets = [PHAsset fetchAssetsWithOptions:self.defaultOptions];
[assets enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[list addObject:obj];
}];
PHFetchResult* collections = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumCloudShared options:nil];
[collections enumerateObjectsUsingBlock:^(PHAssetCollection* collection, NSUInteger idx, BOOL *stop) {
PHFetchResult* assets2 = [PHAsset fetchAssetsInAssetCollection:collection options:options];
[assets2 enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {