I have a block of code that will update information in the Parse database. I set up an action so that when the information is saved, it gets updated in the background. the function is being executed, but its not saving anything back to the database. its going through the function, but no changes are being saved. The changed values are inside a text field and a switch.
- (IBAction)save:(id)sender {
NSLog(@"classnameinsave %@", self.productTitleField.text);
PFQuery *query = [PFQuery queryWithClassName:self.className];
[query getObjectInBackgroundWithId:self.productId block:^(PFObject *object, NSError *error) {
NSLog(@"inside getObjectsInBackgroundWithId function");
NSLog(@"priceinsave %@", object[@"price"]);
object[@"title"] = self.productTitleField.text;
object[@"price"] = self.priceField;
object[@"quantity"] = self.quantityField;
object[@"show"] = self.show;
[object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if(succeeded){
NSLog(@"Succeeded in Saving");
}else if(error){
NSLog(@"Error with saving changes %@", error);
}
}];
}];
}
Aucun commentaire:
Enregistrer un commentaire