swift - Getting PFUser's username (Parse.com) -
i trying username of pfuser. code below works without line:var username = nameid.username string
when added collection view not show results. ideas?
var query = pfquery(classname:"chat") // query.wherekey("user", equalto:currentuser) query.wherekey("rideid", equalto:currentobjectid) query.orderbyascending("createdat") query.findobjectsinbackgroundwithblock { (objects: [anyobject]!, error: nserror!) -> void in if error == nil { // find succeeded. nslog("successfully retrieved \(objects.count) scores.") // found objects object in objects { nslog("%@", object.objectid) var testid = object.objectid println(testid) self.orderedidarray.append(testid) var message = object.objectforkey("message") string self.messagestring = message self.messagearray.append(self.messagestring) println(message) var nameid = object.objectforkey("user") pfuser var username = nameid.username string self.namestring = username self.namesarray.append(self.namestring) self.collectionview?.reloaddata() } } else { // log details of failure nslog("error: %@ %@", error, error.userinfo!) } }
it working line:
query.includekey("user")
Comments
Post a Comment