所有在线文档和示例都展示了如何使用PHContentEditingInput和PHContentEditingOutput编辑/更改资产。我没有找到任何关于将图像重置或恢复到原始图像的信息。写入renderedContentURL的任何内容都被视为编辑,因此不是我想要的。请在此分享我的发现:
答案 0 :(得分:1)
使用revertAssetContentToOriginal
夫特:
PHPhotoLibrary.shared().performChanges({
let request = PHAssetChangeRequest(for:asset)
request.revertAssetContentToOriginal()
}, completionHandler: { success, error in
if !success { print("can't revert asset: \(error)") }
})
目标C:
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *change = [PHAssetChangeRequest changeRequestForAsset:asset];
[change revertAssetContentToOriginal];
} completionHandler:^(BOOL success, NSError *error) {
NSLog(@"Finished adding asset. %@", (success ? @"Success" : error));
}];