我创建了一个自定义文件夹,通过我的应用程序将图像保存在库中(实现了如下代码)。现在我想为保存的图像设置自定义名称。我怎样才能实现这一挑战?如果有人可以帮助我实现这一挑战。
func save(image: UIImage, strName : String) {
self.checkAuthorizationWithHandler { (success) in
if success, self.assetCollection != nil {
PHPhotoLibrary.shared().performChanges({
let assetChangeRequest = PHAssetChangeRequest.creationRequestForAsset(from: image)
let assetPlaceHolder = assetChangeRequest.placeholderForCreatedAsset
let albumChangeRequest = PHAssetCollectionChangeRequest(for: self.assetCollection)
let enumeration: NSArray = [assetPlaceHolder!]
albumChangeRequest!.addAssets(enumeration)
}, completionHandler: nil)
}
}
}