【发布时间】:2015-10-28 11:32:19
【问题描述】:
我已经开始研究文档目录和照片库。到目前为止,我能够做的事情是:
将文件保存在“照片”中。
从“照片”中获取文件。
从文档目录访问文件。
- 保存文档目录中的文件。
现在我面临的问题是从“照片”库中删除资产。该怎么做?
我在 Apple 文档中读到我应该使用“PHAssetCollectionChangeRequest”类。于是我写了如下代码:
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCollectionChangeRequest *chng = [PHAssetCollectionChangeRequest new];
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:528];
[chng removeAssetsAtIndexes:indexSet];
// [PHAssetChangeRequest creationRequestForAssetFromImage:[UIImage imageNamed:@"abc.png"]];
} completionHandler:^(BOOL success, NSError *error){
if (success) {
NSLog(@"Success");
}
else {
NSLog(@"write error : %@",error);
}
}];
但它什么也没做。我可以得到一些代码吗?
【问题讨论】:
标签: ios photosframework