Skip to content

Commit

Permalink
bugfix: added support for synchronized albums from itunes Tencent#191
Browse files Browse the repository at this point in the history
  • Loading branch information
kayo5994 committed Sep 5, 2017
1 parent a62a96e commit 05bb938
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions QMUIKit/UIComponents/AssetLibrary/QMUIAssetsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@ + (NSArray *)fetchAllAlbumsWithAlbumContentType:(QMUIAlbumContentType)contentTyp
}
}
}

// 获取从 macOS 设备同步过来的相册,同步过来的相册不允许删除照片,因此不会为空
PHFetchResult *macCollections = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumSyncedAlbum options:nil];
// 循环从 macOS 设备同步过来的相册
for (NSInteger i = 0; i < macCollections.count; i++) {
// 获取一个相册
PHCollection *collection = macCollections[i];
if ([collection isKindOfClass:[PHAssetCollection class]]) {
PHAssetCollection *assetCollection = (PHAssetCollection *)collection;
[tempAlbumsArray addObject:assetCollection];
}
}

NSArray *resultAlbumsArray = [tempAlbumsArray copy];
return resultAlbumsArray;
}
Expand Down

0 comments on commit 05bb938

Please sign in to comment.