Commit 3c6c6cb5 authored by zhouzhiqiang1's avatar zhouzhiqiang1 Committed by GitHub

PHCollectionList类的的对象,过滤掉

有可能是PHCollectionList类的的对象,过滤掉(ps过滤不应该 return的吧)
parent d0efb6a1
...@@ -87,7 +87,7 @@ static CGFloat TZScreenScale; ...@@ -87,7 +87,7 @@ static CGFloat TZScreenScale;
PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil]; PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];
for (PHAssetCollection *collection in smartAlbums) { for (PHAssetCollection *collection in smartAlbums) {
// 有可能是PHCollectionList类的的对象,过滤掉 // 有可能是PHCollectionList类的的对象,过滤掉
if (![collection isKindOfClass:[PHAssetCollection class]]) return; if (![collection isKindOfClass:[PHAssetCollection class]]) continue;
if ([self isCameraRollAlbum:collection.localizedTitle]) { if ([self isCameraRollAlbum:collection.localizedTitle]) {
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option]; PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
model = [self modelWithResult:fetchResult name:collection.localizedTitle]; model = [self modelWithResult:fetchResult name:collection.localizedTitle];
...@@ -125,7 +125,7 @@ static CGFloat TZScreenScale; ...@@ -125,7 +125,7 @@ static CGFloat TZScreenScale;
for (PHAssetCollection *collection in smartAlbums) { for (PHAssetCollection *collection in smartAlbums) {
// 有可能是PHCollectionList类的的对象,过滤掉 // 有可能是PHCollectionList类的的对象,过滤掉
if (![collection isKindOfClass:[PHAssetCollection class]]) return; if (![collection isKindOfClass:[PHAssetCollection class]]) continue;
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option]; PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
if (fetchResult.count < 1) continue; if (fetchResult.count < 1) continue;
if ([collection.localizedTitle containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue; if ([collection.localizedTitle containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue;
...@@ -137,7 +137,7 @@ static CGFloat TZScreenScale; ...@@ -137,7 +137,7 @@ static CGFloat TZScreenScale;
} }
for (PHAssetCollection *collection in topLevelUserCollections) { for (PHAssetCollection *collection in topLevelUserCollections) {
// 有可能是PHCollectionList类的的对象,过滤掉 // 有可能是PHCollectionList类的的对象,过滤掉
if (![collection isKindOfClass:[PHAssetCollection class]]) return; if (![collection isKindOfClass:[PHAssetCollection class]]) continue;
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option]; PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
if (fetchResult.count < 1) continue; if (fetchResult.count < 1) continue;
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]]; [albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment