I tried to use UIImagePNGRepresentation
but when i upload the images to Parse they are too big, but the small images were working fine. For that reason i tried to use UIImageJPEGRepresentation
, but it doesnt matter if the image is big or small, always get an error "Invalid type for key imagem1, expected file, but got string":
let imageData = UIImageJPEGRepresentation(restaurante.imagem[0],0.75)
let imageFile = PFFile(name:"image.png", data:imageData).description
Restaurantes["imagem1"] = imageFile
Restaurantes.saveInBackground()
Got a string? How? Thank you :)
You have added .description
to the end of the definition, so you're creating your PFFile
instance and then getting the description of it. Remove that part of the line.