I'm working on a Parse query that pulls geo-based names and photos then loading them onto a table view. The first part of the query is coming through without an issue. I'm stuck on the second part of pulling/loading photos.
I could be going wrong with a missing call for the images in queryForTable method. Here I've tried includeKey (which failed as it's not a pointer to another object); I've also called for images, using getDataInBackgroundWithBlock. In each instance, I would then try loading the queried objects onto table view with a line like cell.imageData.image = photo.
But differing SO accounts also indicate that the call could go in the tableView method, which is what I have below. I've combed through SO, Parse.com and other resources, but I haven't come across a solution yet. Hoping someone can help:
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!, object: PFObject?) -> Stores! {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! Stores
if let object = object {
let Name = object.valueForKey("Name") as? String
cell.storeList.text = Name
let photo = object.objectForKey("Photos") as? PFFile
photo?.getDataInBackgroundWithBlock {(imageData: NSData!, error: NSError!) -> Void in
if error == nil {
let image = UIImage(data: imageData)
cell.storeImage.file = photo
}
}}
return cell as Store