this error message:
cannot invoke 'getobjectinbackgroundwithid' argument list of type '(string, (pfobject!,nserror!) -> void)'
this code looks like:
func calldata(){ var query : pfquery = pfquery(classname: "questionsandanswers") query.getobjectinbackgroundwithid("ixcrgclkk2"){ (object : pfobject!, error : nserror!) -> void in if (error == nil){ self.question = object["question"] string! self.answers = object["answers"] array! self.answer = object["answer"] string! if (self.answers.count > 0){ self.questionlabel.text = self.question } } else { nslog("there wrong!") } } } i have tried changing around exclamation point/question mark/nothing behind pfobject , nserror nothing works. however, if make question mark behind both pfobject , nserror new error message says:
'anyobject' not convertible 'string!';did mean use 'as!' force downcast?
if change code as! error:
cannot assign immutable value of type 'string!'
any ideas on how fix this? appreciated!
have : http://blog.parse.com/announcements/building-apps-with-parse-and-swift/
i think work
var query = pfquery(classname: "questionsandanswers") query.getobjectinbackgroundwithid("ixcrgclkk2", block: { (object:pfobject?, error:nserror?) -> void in if let error = error { //error } else if let object = object{ //do object pfobject // such var question:string = object.objectforkey("question") as! string } })
Comments
Post a Comment