xcode - Swift Compiler Error Command failed due to signal: Segmentation fault: 11 -
clubcomments.removeallobjects() let findclubcommentdata:pfquery = pfquery(classname: "testobject") findclubcommentdata.findobjectsinbackgroundwithblock { (objects:[pfobject]?, error:nserror?) -> void in if (error == nil && objects != nil) { object:pfobject! in objects!{ self.clubcomments.addobject(object) } let array: nsarray = self.clubcomments.reverseobjectenumerator().allobjects self.clubcomments = array as! nsmutablearray self.tableview.reloaddata()
getting error code... suggestions on how fix it? im stuck...
in swift use native collection types, avoids errors. example swift array has function reverse()
more efficient reverseobjectenumerator().allobjects
declare clubcomments
var clubcomments = [pfobject]()
and try
clubcomments.removeall() let findclubcommentdata = pfquery(classname: "testobject") findclubcommentdata.findobjectsinbackgroundwithblock { (objects:[pfobject]?, error:nserror?) -> void in if error == nil { self.clubcomments = objects!.reverse() self.tableview.reloaddata() } }
Comments
Post a Comment