• 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
Re: CoreData, reset a persistent store
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData, reset a persistent store


  • Subject: Re: CoreData, reset a persistent store
  • From: Elise van Looij <email@hidden>
  • Date: Wed, 15 Nov 2006 17:47:29 +0100

Op 14-nov-2006, om 17:20 heeft Pierre Chatelier het volgende geschreven:

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

Sorry, I don't know enough about memory management to help you with that. What I don't quite understand from your solution, though, is why you want to discard all the pending changes. If you don't want to have any pending changes, don't allow your users to make any changes. That way you won't have to worry about throwing them away.


Elise van Looij


_______________________________________________ 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
  • Follow-Ups:
    • Re: CoreData, reset a persistent store
      • From: "Marcus S. Zarra" <email@hidden>
References: 
 >CoreData, reset a persistent store (From: Pierre Chatelier <email@hidden>)
 >Re: CoreData, reset a persistent store (From: Elise van Looij <email@hidden>)
 >Re: CoreData, reset a persistent store (From: Pierre Chatelier <email@hidden>)
 >Re: CoreData, reset a persistent store (From: Elise van Looij <email@hidden>)

  • Prev by Date: Cocoa Bindings - removeObserver if I know the observed instance
  • Next by Date: Knowing when an app is launched and becomes active?
  • Previous by thread: Re: CoreData, reset a persistent store
  • Next by thread: Re: CoreData, reset a persistent store
  • Index(es):
    • Date
    • Thread