Day, guys. Help me.I can not solve the problem for three days
I make an app look like an Instagram. I want to make sure that when you create a post, in cell of tableview, writing his nickname.
I am try this:
findSweeter.findObjectsInBackgroundWithBlock{
(objects:[AnyObject]?, error:NSError?)->Void in
if error == nil{
let user:PFUser = (objects as NSArray).lastObject as PFUser!
cell1.usernamelabel.text = user.username
}
}
}
But thats issue: [AnyObject]? is not convertible to 'NSArray' & 'NSArray is not convertible to PFUser'
Help, pls. im using Parse.com
I solved my problem so easly. I just changed PFUser variable in Data on Parse Clotd to String:
cell1.usernamelabel.text = sweet.objectForKey("usa") as? String
The problem isn't the cast, but the fact that
objects
is an optional array:[AnyObject]?
You have to unwrap the array first: