PHFetchOptions *fetchOptions = [[PHFetchOptionsalloc] init];
fetchOptions.sortDescriptor = @[[NSSortDescriptorsortDescriptorWithKey:@"startDate"ascending:YES]];
//localIdentifier, startDate
// 获取照片流
// PHFetchResult *aList = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumMyPhotoStream options:fetchOptions];
// [listsArray addObject:aList];
// 获取全景照片
// aList = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeSmartAlbumPanoramas options:fetchOptions];
// [listsArray addObject:aList];
//
PHFetchResult *userAlbumList = [PHCollectionfetchTopLevelUserCollectionsWithOptions:fetchOptions];
[listsArrayaddObject:userAlbumList];
for (PHFetchResult *listin listsArray) {
for (PHAssetCollection *collectionin list) {
// NSLog(@"........%@.......", collection.localizedTitle);
// NSLog(@"。。。。。。%ld。。。。。。", (long)collection.assetCollectionType);
// creationDate
// modificationDate
fetchOptions.sortDescriptors =@[[NSSortDescriptorsortDescriptorWithKey:@"creationDate"ascending:YES]];
PHFetchResult *assets = [PHAssetfetchAssetsInAssetCollection:collection options:fetchOptions];
if ([assetscountOfAssetsWithMediaType:PHAssetMediaTypeImage] >0) {
[collectionsArrayaddObject:collection];
// NSLog(@"........%@.......", collection.localizedTitle);
}
}
}