I am deleting CoreData objects using this method:
NSManagedObjectContext *theContext = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:nameEntity];
[fetchRequest setIncludesPropertyValues:NO]; //only fetch the managedObjectID
[fetchRequest setPredicate:predicate];
NSError *error;
NSArray *fetchedObjects = [theContext executeFetchRequest:fetchRequest error:&error];
for (NSManagedObject *object in fetchedObjects)
{
[theContext deleteObject:object];
}
error = nil;
if(![theContext save:&error]){
NSLog(@"Couldn't save: %@", error);
}
What I don't understand is that for instance I download data and store it, and in the Settings I can see that my app uses 5MB of disk space. Once I delete the data using this method, it says my app uses 6.3MB of data. That makes absolutely no sense at all. What am I doing wrong? Why isn't the data being deleted correctly?