-1

我尝试使用UIImagePNGRepresentation,但是当我将图像上传到 Parse 时,它​​们太大了,但小图像工作正常。出于这个原因,我尝试使用UIImageJPEGRepresentation,但图像大小无关紧要,总是得到一个错误“密钥 imagem1 的类型无效,预期文件,但得到字符串”:

    let imageData = UIImageJPEGRepresentation(restaurante.imagem[0],0.75)
    let imageFile = PFFile(name:"image.png", data:imageData).description
    Restaurantes["imagem1"] = imageFile

    Restaurantes.saveInBackground()

有弦吗?如何?谢谢 :)

4

1 回答 1

1

您已添加.description到定义的末尾,因此您正在创建您的PFFile实例,然后获取它的描述。删除该行的那部分。

于 2015-08-10T18:12:41.747 回答