I'm new in StackMob, so please excuse me for this basic question. The tutorials there are lacking.
When I create a new object and save the NSManagedObjectContext right away, the object is saved successfully.
But normally when I use core data, I save the context only in applicationDidEnterBackground & applicationWillTerminate.
When I put my saving code there, it just doesn't save!
I've tried the following code:
NSManagedObjectContext *context = [self.coreDataStore contextForCurrentThread];
[context saveOnSuccess:^{
NSLog(@"Success!");
}
onFailure:^(NSError *error) {
NSLog(@"Error: %@",error);
}];
It works well when I save immediately, but when this peace of code is in the methods mentioned above, it doesn't print anything!
Not "success" and not "error", and of course that on the web I don't see the new object.
Well, when should I save the changes that are made in my app? Obviously I can't save them anytime there's a change.
Thanks.