i stuck on issue. i've read parse documentation (https://parse.com/docs/ios/guide#queries-query-constraints) doesn't helps me much.
the error
when try "createdat" or "updatedat" pfobject, got following error:
['pfobject'] not have member named 'createdat'
the code
here (shortened) function:
func loadcheckindata() { var query = pfquery(classname: "checkin") query.orderbydescending("createdat") query.selectkeys(["firstname","lastname","updatedat","createdat"]) query.findobjectsinbackgroundwithblock({ (objects: [anyobject]?, error: nserror?) -> void in if error == nil { println(objects) // if let object = objects as? [pfobject] { println("\(object.createdat)") <---- error here self.checkedpatients = array(object.generate()) } } else { // log details of failure println("error: \(error!) \(error!.userinfo!)") } }) } then retrieve "firstname", "lastname" (and try retrieve "createdat") in "checkin" parse's class following code
func collectionview(cellview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { // add parse data if let value = checkedpatients[indexpath.row]["lastname"] as? string { cell.celllabeltwo.text = value } if let value = checkedpatients[indexpath.row]["firstname"] as? string { cell.celllabel.text = value } if let value = checkedpatients[indexpath.row]["createdat"] as? string { cell.cellday.text = value } return cell } and call function
override func viewdidappear(animated: bool) { loadcheckindata() } in fact tried differents method "createdat" value, , can't make works. have idea (and quick explanation if possible) nice. thank !
it's because updatedat/createdat property on pfobjects, no need retrieve using key, treat property.
Comments
Post a Comment