Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
app crashed when creating album
__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];