swift - How to respond to the error [Error]: Caught "NSInternalInconsistencyException" with reason "PFObject contains container item that isn't cached." -
to start off let me yes, question has been asked before, can't comment or ask question on pervious 1 i'm stuck it: how store dictionary on parse using swift? before continue let me give context error. iv'e been using parse ios app i'm making, , in screen 'a' make object, find corraponing group object in parse array stored in group object, add item array. , save parse. next on screen 'b' have table view grabs items , presents them. know there no problems screen 'b' because i've tested it. seems item not being added group object , frustrating. reason there error when click screen 'b' see if item saved [error]: caught "nsinternalinconsistencyexception" reason "pfobject contains container item isn't cached."
if code im using save item seems failing here is. @ibaction func
addbuttontapped(sender: anyobject) { if (itemname.text != "" && itemdescription.text != "") { let newitem = item() newitem.name = itemname.text! newitem.descrpiton = itemdescription.text newitem.gotten = false newitem.rejected = false newitem.sender = pfuser.currentuser()!.username! let query = pfquery(classname: "group") query.wherekey("objectid2", equalto: pfuser.currentuser()!.objectid!) query.findobjectsinbackgroundwithblock { (objects, error) -> void in if error == nil && objects != nil{ let obj = (objects as! [pfobject]).first! var items : [item] = obj.objectforkey("itemlist") as! [item] newitem.group = obj.objectid! items.append(newitem) obj.setobject(items, forkey: "itemlist") obj.save() } } itemname.resignfirstresponder() itemdescription.resignfirstresponder() bottomconstraint.constant = -140 itemname.text = "" itemdescription.text = "" }else{ } }
Comments
Post a Comment