im new to iOS and developing twitter like app using tutorials.
people can make tweets from their account. and it get display in home page.
at the moment to home page all the tweets and everything works well except username. im getting nil
this is what i have tried
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:SpreadTableViewCell = tableView!.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! SpreadTableViewCell
let spread:PFObject = self.LiveFeedData.objectAtIndex(indexPath.row) as! PFObject
//----------This Content Works fine ----------------
cell.spreadTextView.text = spread.objectForKey("content") as! String
//Spreader
var findSpreader:PFQuery = PFUser.query()!
findSpreader.whereKey("objectId", equalTo: spread.objectForKey("spreader")!)
findSpreader.findObjectsInBackgroundWithBlock{
(objects:[AnyObject]?, error:NSError?)-> Void in
if error==nil{
let user = (objects as! [PFUser]).last
//but this one giving me nil
cell.username.text = user?.username
}
}
return cell
}


spreadervalue in your record is a PFUser, so instead of running a find, you can just read it usingfetchInBackgroundWithBlock