How can set PFFILE into local UIImage in objective c

379 views Asked by At

How can set local UIImage toPFFILE`

I haven't got image from parse database i have use uiimagepickercontroller

I have try to this code but not set image in PFImageView

UIImage *img=[UIImage imageNamed:@"Group_icon.png"];
PFFile *file = [PFFile fileWithName:@"Image.jpg"  data:UIImagePNGRepresentation(img)];
[imageUser setFile:file];
[imageUser loadInBackground];

Please help me

1

There are 1 answers

0
vogonistic On

I've come across this same issue. You can't use a PFFile in a PFImageView until it's been saved to the server and fetched. Probably something with how the caching works and using the url as key. The simple solution is to save it, then fetch it and set it on the imageview, but it's slow. The better solution is to keep the UIImage around, maybe in a NSCache or something, and use that until it's been saved to the server.