Last active
October 16, 2017 07:57
-
-
Save kwangbae/69d06c96a82701eebddd to your computer and use it in GitHub Desktop.
Getting all photos except iCloud sharing photos using PHAsset class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
[exceptList addObject:obj]; | |
}]; | |
}]; | |
[list removeObjectsInArray:exceptList]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment