使用以下代码时遇到编译器错误:
func saveImageToDisk() {
let imageData = UIImagePNGRepresentation(imageView.image!)!
let fileName = getDocumentsDirectory().appendingPathComponent("image.png")
imageData.writeToFile(fileName, atomically: true)
}
错误是:Value of type 'Data' has no member 'writeToFile'
这可能是编译器错误,还是我错过了什么?感谢