我正在尝试导入一个PFFile,它是一个图像并将其放在一个单元格中,但我收到错误fatal error: Index out of range
。我为什么要这个?我如何解决它?我是否正确导入图像?
if let imagepic = object["Animal"] as? PFObject{
if let imageofpic = imagepic["Pic"] as? PFFile{
imageofpic.getDataInBackgroundWithBlock({ (data: NSData?, error: NSError?) -> 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) -> UITableViewCell {
let cell: extrasescell = table.dequeueReusableCellWithIdentifier("extra") as! extrasescell
cell.pic.image = imagepro[indexPath.row]
return cell
}