ios - Parse Swift: Check if update was successfully committed -


i performing update operation , know how can know if saveinbackground successful or not. code using below. if successful show alert view , if not display error.

query.getobjectinbackgroundwithid(objectid!) {     (userinstance: pfobject?, error: nserror?) -> void in     if error != nil {         println(error)     } else if let userinstance = userinstance {         userinstance["number1"] = number1         userinstance["number2"] = number2         userinstance.saveinbackground()         //self.performseguewithidentifier("cancelchangessegue", sender: nil)          var alert = uialertview()         alert.title = "number updated!"         alert.message = "you've updatd number"         alert.addbuttonwithtitle("great!")         alert.show()     } } 

userinstance.saveinbackgroundwithblock {     (success: bool, error: nserror?) -> void in         if (success) {             // object has been saved.             // stuff here             var alert = uialertview()             alert.title = "number updated!"             alert.message = "you've updatd number"             alert.addbuttonwithtitle("great!")             alert.show()         } else {            // there problem, check error.description         } } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -