0
CloudKit에 레코드를 저장하려고합니다. 레코드에는 2 개의 문자열이 포함되고 CKAsset
에는 UIImage
이 저장됩니다. 나는 CKAsset
를 사용하지 않을 때CloudKit을 사용하여 레코드를 저장할 때 해당 파일이나 디렉토리가 없습니다.
let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
let filePath = "file://\(path)/NewPicture.jpg"
do {
try UIImageJPEGRepresentation(newPicture!, 1)!.write(to: URL(string: filePath)!)
} catch {
print("Error saving image to URL")
print(error)
self.errorAlert(message: "An error occurred uploading the image. Please try again later.")
}
let asset = CKAsset(fileURL: URL(string: filePath)!)
record.setObject(asset, forKey: "picture")
, 레코드가 잘 업로드 : 여기에 자산을 만들기위한 내 코드입니다. 그러나 이제 다음과 같은 오류 메시지가 나타납니다.
open error: 2 (No such file or directory)
이 오류를 제거하고 기록을 올바르게 저장할 수 있습니까? 감사!