2

I'm using Back4App's service to host Parse server and I can't seem to successfully remove a field from a row. The field in question is a pointer to another object, and calling removeObjectForKey followed by a save does not work. Other updates work in the same batch, and I have seen that 4 times out the 36 that I have tried, it did successfully delete the object.

[self.myProfile removeObjectForKey:@"partnership"];
[self.myProfile saveEventually:^(BOOL succeeded, NSError * _Nullable error) {
    NSLog(@"success %d", succeeded);  //always returns true
}];

Is this a known problem with Back4App? Or Parse itself? I tried the same code in swift and it worked.

Any ideas?

theDuncs
  • 4,649
  • 4
  • 39
  • 63

1 Answers1

0

When you need to run a callback, to confirm when is deleted, is recommended the deleteInBackgroundWithBlock: or deleteInBackgroundWithTarget:selector: methods. You can delete a single field from an object with the removeObjectForKey method:

// After this, the playerName field will be empty
[classScore removeObjectForKey:@"customName"];

// Saves the field deletion to the Parse Cloud
[classScore saveInBackground];

About the saveEventually, most save functions execute immediately, and inform your app when the save is complete. If you don’t need to know when the save has finished, you can use saveEventually instead. The advantage is that if the user currently doesn’t have a network connection.

Content from Parse =D

nataliec
  • 502
  • 4
  • 14