Slee
Slee

Reputation: 28268

FireBase removeValue in iOS not always persisting to database

I am testing FireBase in my iOS app and it is pretty amazing so far but it seems if I use [fb removeValue]; when I am not connected the change is not always reflected any where else.

Here is my code:

-(void) deleteFromFirebase {
    Firebase *fb =[[Firebase alloc] initWithUrl:[NSString stringWithFormat:@"https://repzio.firebaseio.com/orders/%@/%@",self.purchaseOrder.ManufacturerID, self.purchaseOrder.OrderGUID]];
    [fb removeValue];
}

Obviously this causes issues when the app need to remove data and have it persisted. Has anyone else run into this issue? Am I handling this wrong?

Upvotes: 0

Views: 1062

Answers (1)

Logan
Logan

Reputation: 53132

I would use blocks!

[fb removeValueWithCompletionBlock:^(NSError *error, Firebase *ref) {
    if (!error) {
        // Save worked
    }
    else {
        // cache for later, or notify user that there was an error and they should try again.
    }
}];    

Upvotes: 3

Related Questions