__block PHObjectPlaceholder *placeholder = nil;
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCollectionChangeRequest *request = [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:title];
placeholder = request.placeholderForCreatedAssetCollection;
} completionHandler:^(BOOL success, NSError *error) {
if (resultBlock) {
PhotoAlbum *resultAlbum = nil;
if (placeholder) {
PHFetchResult<PHAssetCollection *> *collectionResult = [PHAssetCollection fetchAssetCollectionsWithLocalIdentifiers:@[
placeholder.localIdentifier
] options:nil];
if (collectionResult.count) {
resultAlbum = [[PhotoAlbum alloc] initWithPHAssetCollection:[collectionResult firstObject]
options:[self assetFilterFetchOptions:self.fetchOption]];
} else {
success = NO;
error = [NSError errorWithDomain:kDomain code:AlbumNoFound userInfo:@{@"error" : [NSString stringWithFormat:@"没有找到标题为%@的相册", title]}];
}
}
dispatch_async(dispatch_get_main_queue(), ^{
resultBlock(success, error, resultAlbum);
});
}
}];
crash in this:
PHFetchResult<PHAssetCollection *> *collectionResult = [PHAssetCollection fetchAssetCollectionsWithLocalIdentifiers:@[
placeholder.localIdentifier
] options:nil];
Post
Replies
Boosts
Views
Activity
It is correct in iOS 15 beta8
NSInteger row = indexPath.item + 1; if (row > 0 && row < [self.dataSource collectionView:self numberOfItemsInSection:indexPath.section]) { [UIView animateWithDuration:.3 animations:^{ [self scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:row inSection:indexPath.section] atScrollPosition:UICollectionViewScrollPositionNone animated:NO]; }]; }