且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我使用UIImagePickerController拾取图像后如何从PhotoLibrary中删除图像

更新时间:2023-01-06 13:06:35

只需添加到上面, 对于Swift 3.0,它对我有用.

Just to add to the above, For swift 3.0 this worked for me.

PHPhotoLibrary.shared().performChanges({
                let imageAssetToDelete = PHAsset.fetchAssets(withALAssetURLs: imageUrls as! [URL], options: nil)
                PHAssetChangeRequest.deleteAssets(imageAssetToDelete)
            }, completionHandler: {success, error in
                print(success ? "Success" : error )
            })