Commit 2fa670b5 authored by dianyi's avatar dianyi

获取相册时候增加了一个判断,避免崩溃

获取相册时候增加了一个判断,避免崩溃
parent d7783ad2
......@@ -125,7 +125,11 @@ 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:@"我的照片流"]) {
[albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle] atIndex:1];
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]];
}
......@@ -141,7 +145,11 @@ static CGFloat TZScreenScale;
if ([name isEqualToString:@"Camera Roll"] || [name isEqualToString:@"相机胶卷"]) {
[albumArr insertObject:[self modelWithResult:group name:name] atIndex:0];
} else if ([name isEqualToString:@"My Photo Stream"] || [name isEqualToString:@"我的照片流"]) {
[albumArr insertObject:[self modelWithResult:group name:name] atIndex:1];
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]];
}
......
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