Alexsander Alexsander -4 years ago 105
iOS Question

How to load file(it is image) from parse in swift ios application?

How to load file(it is image) from in swift ios application? I tried as stated on the but does not work. There is an error "'PFFile?' is not convertible to 'StringLiteralConvertible'". Please tell me how to upload multiple images.

if let imageNews = object["imageNews"] as? PFFile {
cell!.imageView.image = UIImage(named: "placeholder.jpg")
cell!.imageView.file = thumbnail

Answer Source

I found a solution of my error. This is below. Thank everybody.

  var imageFromParse = object?.objectForKey("imageNews") as? PFFile
        imageFromParse!.getDataInBackgroundWithBlock({ (imageData: NSData?, error: NSError?) -> Void in
            var image: UIImage! = UIImage(data: imageData!)!
            cell?.imageViewCell?.image = image
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download