how can change boolean value of parse class named "shoppingcart" clicking button?
@ibaction func addtocart(sender: anyobject) { var cartobjectstatus = itemobject.valueforkey("shoppingcart") as! bool! cartobjectstatus = false }
itemobject.setbool(false, forkey: "shoppingcart")
the problem original attempt you're setting value of local variable false. using above setbool method alter object's variable.
edit - if pfobject doesn't support setbool
, you'll have go setvalue:forkey
:
itemobject.setvalue(false, forkey: "shoppingcart")
this method on nsobject, pfobject has derive from.