Commit 739cd943 authored by Zhen Tan's avatar Zhen Tan Committed by GitHub

Merge pull request #103 from lastObject/master

获取相册时候增加了一个判断,避免崩溃
parents 231d9cea 2fa670b5
......@@ -125,10 +125,14 @@ static CGFloat TZScreenScale;
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
if (fetchResult.count < 1) continue;
if ([collection.localizedTitle isEqualToString:@"My Photo Stream"] || [collection.localizedTitle isEqualToString:@"我的照片流"]) {
if (albumArr.count) {
[albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle] atIndex:1];
} else {
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]];
}
} else {
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]];
}
}
if (completion && albumArr.count > 0) completion(albumArr);
} else {
......@@ -141,10 +145,14 @@ static CGFloat TZScreenScale;
if ([name isEqualToString:@"Camera Roll"] || [name isEqualToString:@"相机胶卷"] || [name isEqualToString:@"所有照片"] || [name isEqualToString:@"All Photos"]) {
[albumArr insertObject:[self modelWithResult:group name:name] atIndex:0];
} else if ([name isEqualToString:@"My Photo Stream"] || [name isEqualToString:@"我的照片流"]) {
if (albumArr.count) {
[albumArr insertObject:[self modelWithResult:group name:name] atIndex:1];
} else {
[albumArr addObject:[self modelWithResult:group name:name]];
}
} else {
[albumArr addObject:[self modelWithResult:group name:name]];
}
} failureBlock:nil];
}
}
......
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