CoreData + MagicalRecord - Am I saving the details correctly?

Viewed 1293

I have three Applications in my database. I have a predicate that deletes one.

Given the following code:

[Application MR_deleteAllMatchingPredicate: applicationDeletePredicate];
[[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreAndWait];

NSLog(@"We have %ld apps left.", [Application MR_countOfEntities]);

dispatch_async(dispatch_get_main_queue(), ^{
    NSLog(@"We have %ld apps left.", [Application MR_countOfEntities]);
});

I get the following log messages:

We have 2 apps left.

We have 3 apps left.

So it has properly deleted the predicate, but then when I try to do reloading in the main queue, the application still exists. Am I doing this wrong? Should I always specify default context when dealing with MagicalRecord (in my count method)?

1 Answers
Related