• 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: Tue, 14 Nov 2006 17:09:03 +0100


Op 14-nov-2006, om 15:37 heeft Pierre Chatelier het volgende geschreven:

I am wondering how to reset a persistent store used by a single data model.
If I understand you correctly, yes. In Xcode, simply change the url in your appDelegate's (or controllers) .m file:
url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @"someProject.xml"]];
( see http://www.cocoadevcentral.com/articles/000085.php on how to set the correct type).
The build and run will take a bit longer the first time, but that's all. The store itself you'll find under the theUser/Library/ Application Support/SomeProject/
The NSPersistentStoreCoordinator is designed not to care which store you use, as long as it confirms to the expecations of the ManagedObjectContext which in turn looked to the data model for guidance.

I do not understand... Do you mean that I should replace the persistent-file, at run-time, by an empty one that could be embedded in the application resources ?
My problem is that my persistent store contains cached data, and that sometimes i would like to empty it to avoid infinite growing. And that not method of NSPersistentCoordinator proposed to empty the files.

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. But as far as the cache growing to gigantic proportions, I don't think you need to worry about that. If I understand the section on Uniquing and Faulting in the Core Data Programming Guide [http:// developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ index.html?http://developer.apple.com/documentation/Cocoa/Conceptual/ CoreData/Articles/cdAccessorMethods.html#//apple_ref/doc/uid/ TP40002154] correctly, Core Data takes care of all that. Don't fix it if it ain't broke.


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: "I. Savant" <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>)

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