I have the following scenario:
Everything works fine, but when I do a refresh, that transient attribute seems to be getting out of date.
The attribute is returned by an accesssor in my entity object. I tried setting a breakpoint in the accessor, and notice that it's not actually called when my app starts up and my NSFetchedResultsController. This seems to indicate that Core Data is caching this value somewhere (since my table is still section properly). Is there a way to clear this cache?
Yes. Use
+ (void)deleteCacheWithName:(NSString *)name;
The name is the one you provided during NSFetchedResultsController
initialization time, when calling
- (id) initWithFetchRequest:(NSFetchRequest *)fetchRequest managedObjectContext:(NSManagedObjectContext *)context sectionNameKeyPath:(NSString *)sectionNameKeyPath cacheName:(NSString *)name;
setting the cacheName
argument.
Alternatively, you can avoid Core Data caching the data during NSFetchedResultsController
initialization time: simply pass nil
for the cacheName
argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With