• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CoreData, reset a persistent store
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData, reset a persistent store


  • Subject: CoreData, reset a persistent store
  • From: Pierre Chatelier <email@hidden>
  • Date: Tue, 14 Nov 2006 17:20:32 +0100

No, at runtime I don't think that would be a good idea. You might want to take a look at Apple's NSPersistentStoreCoordinator Class Reference.
That's what I did, but there is no method to clear a persistent store.

But as far as the cache growing to gigantic proportions, I don't think you need to worry about that.
I do worry. I don't want my cache file to take dozen of GB, even if only a part of it is in memory (thanks to faulting).

So far, what I do is:
-lock the managed object context
-reset the managed object context to clear all pending changes
-call removePersistentStore:error on the PersistentStoreCoordinator
-remove the underlying file with NSFileManager
-call addPersistentStoreWithType:configuration:URL:options:error on the PersistentStoreCoordinator to re-create the file
-unlock the managed object context


What I was expecting was a method like
@interface NSManagedObjectContext
-(void) clear;
@end

that would remove, from each associated persistent stores, all object of the managed object *fetched or not*. And there is apparently no method like this.
This could be a feature request, but I first want to be sure that I did not miss anything.


Regards,

Pierre Chatelier

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Is it possible to figure out if "File Vault" is in use?
  • Next by Date: NSImage and PNG problems
  • Previous by thread: Re: CoreData, reset a persistent store
  • Next by thread: CoreData, reset a persistent store
  • Index(es):
    • Date
    • Thread