bugfix - try to run "count" on PHCollectionList

This commit is contained in:
Ran Greenberg 2016-07-12 13:22:17 +03:00
parent 8a974c434f
commit e9394a84d1
1 changed files with 10 additions and 1 deletions

View File

@ -65,7 +65,16 @@ RCT_EXPORT_MODULE();
thumbnailSize:(CGSize)thumbnailSize
block:(AlbumsBlock)block {
NSInteger collectionCount = ([collection isKindOfClass:[PHAssetCollection class]]) ? [PHAsset fetchAssetsInAssetCollection:collection options:nil].count : ((PHFetchResult*)collection).count;
NSInteger collectionCount;
if ([collection isKindOfClass:[PHAssetCollection class]]) {
collectionCount = [PHAsset fetchAssetsInAssetCollection:collection options:nil].count;
}
else if ([collection isKindOfClass:[PHFetchResult class]]){
collectionCount = ((PHFetchResult*)collection).count;
}
else {
collectionCount = 0;
}
if (collectionCount > 0){