Data ?' to expected argument type ' Data'"错误?-6ren"> Data ?' to expected argument type ' Data'"错误?-我试图获取 UIImage 的图像信息,然后通过 PFFile 将它们放入。但是在 Xcode 上有以下错误。 "Cannot convert value of type '(CGFloat) -> -6ren">
gpt4 book ai didi

swift - 如何修复此代码上的 "Cannot convert value of type ' (CGFloat) -> Data ?' to expected argument type ' Data'"错误?

转载 作者:行者123 更新时间:2023-11-28 05:39:11 30 4
gpt4 key购买 nike

我试图获取 UIImage 的图像信息,然后通过 PFFile 将它们放入。但是在 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)

错误信息是

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

最佳答案

试试这个

let image = UIImage(named: "320.jpg")
let file = PFFile(data: image.jpegData(compressionQuality: 1.0))

关于swift - 如何修复此代码上的 "Cannot convert value of type ' (CGFloat) -> Data ?' to expected argument type ' Data'"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57551012/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com