-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
Hi bro,
Please test the following scenario which I got crashed.
- create an empty folder in Photos(Apple App), let's call it 'test'
- run your application
Result : Application will crash when loading photo.
Reason: Application tries to create thumbnail, but the empty folder haven't had photo yet. It means the operation is on the nil pointer.
Source : AssetHelper.m
- (NSDictionary *)getGroupInfo:(NSInteger)nIndex
{
return @{@"name" : [_assetGroups[nIndex] valueForProperty:ALAssetsGroupPropertyName],
@"count" : @([_assetGroups[nIndex] numberOfAssets]),
@"thumbnail" : [UIImage imageWithCGImage:[(ALAssetsGroup*)_assetGroups[nIndex] posterImage]]};
}
My temp solution
- (NSDictionary *)getGroupInfo:(NSInteger)nIndex
{
if ([_assetGroups[nIndex] numberOfAssets] != 0) {
return @{@"name" : [_assetGroups[nIndex] valueForProperty:ALAssetsGroupPropertyName],
@"count" : @([_assetGroups[nIndex] numberOfAssets]),
@"thumbnail" : [UIImage imageWithCGImage:[(ALAssetsGroup*)_assetGroups[nIndex] posterImage]]};
} else {
return @{@"name" : [_assetGroups[nIndex] valueForProperty:ALAssetsGroupPropertyName],
@"count" : @([_assetGroups[nIndex] numberOfAssets])};
}
}
Workflow:
Check whether the folder has photo,
- if has, work as previous
- if not, don't generate image for thumbnail.
Result:
UI will list the empty folder name as well.
It shows empty content if user clicks into the folder.
Plus:
And even you may not want to list the empty folder in the list, this depends on your designate UX, here I just give the report and simple solution.
Cheers
Metadata
Metadata
Assignees
Labels
No labels