Why is the query returning a nil when called in CellForRow method?
<p>I am trying to import a PFFile which is an image and put that in a cell, but I get the error <code>fatal error: Index out of range</code>. Why am I getting this? How do I fix it? Am I importing the image correctly?</p>

<pre><code>if let imagepic = object["Animal"] as? PFObject{
                    if let imageofpic = imagepic["Pic"] as? PFFile{
                        imageofpic.getDataInBackgroundWithBlock({ (data: NSData?, error: NSError?) -&gt; Void in
                            if(error == nil){
                                let image = UIImage(data: data!)
                                self.imagepro.append(image!)
                                dispatch_async(dispatch_get_main_queue()){
                                    self.table.reloadData()
                                }

                            }else{
                                print(error)
                            }

                        })

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
    let cell: extrasescell = table.dequeueReusableCellWithIdentifier("extra") as! extrasescell
    cell.pic.image = imagepro[indexPath.row]

    return cell
}
</code></pre>