How to fix “Cannot convert value of type '(CGF

2020-04-28 08:08发布

I tried to get image info for UIImage and then put them it through PFFile. But there is the below error on Xcode.

"Cannot convert value of type '(CGFloat) -> Data?' to expected argument type 'Data'"

let imageData = UIImage.jpegData(imageView.image!)

let file = PFFile(name: "320.jpg", data: imageData)

The error message is

"Cannot convert value of type '(CGFloat) -> Data?' to expected argument type 'Data'"

标签: swift
1条回答
爷、活的狠高调
2楼-- · 2020-04-28 08:45

Try this

let image = UIImage(named: "320.jpg")
let file = PFFile(data: image.jpegData(compressionQuality: 1.0))
查看更多
登录 后发表回答