Parse and Swift: Add comment to post through Array to a Object Using a Relation? -


i new swift , parse... have tried reading through documentation parse on how make comments on post , have seen different ways confused. now, have chosen create array because don't believe there lot of comments(for time being).

so way set have class in parse known "posts" in class there column string "post" , column array "comments".

i have "posts" being presented in tableview , when user prompted view controller(showing post , time posted) has comment button on bottom prompts comment view controller modally.

the postpressed function adding text comment array new row , not adding text comment array in row of original post.

  @ibaction func postpressed(sender: anyobject) {     var object = pfobject(classname: "post")     object.addobject(self.commentview?.text, forkey: "comment")     object.saveinbackground() 

like said, tried reading documentation , confused on whether there should pfrelation or pfquery relate comment post.

the array approach should work, though relationship better suited , more flexible future needs, knowing commented, how many times yhey commented, blah.

the problem calling var object = pfobject(classname: "post") you're creating new empty post object , adding single comment it. should passing post user selected comment view controller , updating post instead.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -