Wednesday, 21 August 2013

Core Data: How to fault freshly created managed objects

Core Data: How to fault freshly created managed objects

I am creating new managed objects in a loop, save them and would like to
fault them right after saving them to reduce the RAM footprint.
This is how I create the managed objects:
[objects enumerateObjectsUsingBlock:^(PFObject *obj, NSUInteger idx, BOOL
*stop) {
@autoreleasepool {
ForexHistory *forexHistory = [NSEntityDescription
insertNewObjectForEntityForName:localEntityName
inManagedObjectContext:backgroundContext];
forexHistory.date = obj[@"date"];
}
}];
NSError *saveError = nil;
[backgroundContext save:&saveError];
In order to fault the objects, I understand that I need to use
refreshObjects:mergeChanges.
Do I need to refetch all inserted objects in order to iterate over them
and send refreshObjects:mergeChanges:NO to each of them or is there a
better way?

No comments:

Post a Comment