• 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: Core Data: where is the default store in a CD-Document-Based-App?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: where is the default store in a CD-Document-Based-App?


  • Subject: Re: Core Data: where is the default store in a CD-Document-Based-App?
  • From: Melissa Turner <email@hidden>
  • Date: Tue, 23 Aug 2005 12:04:40 -0700


On Aug 23, 2005, at 07:04, Peter Laurens wrote:
After I create the in-memory store ([documentStoreCoordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:&error];) nothing gets saved when I call the 'save' command from the File menu in my app.

So I assume that everything is going, by default, into the in- memory store. Which has taken precedence for use over the 'default' original store that was used before I started messing with the persistent stores in code.

So I'd like a way to call assignObject:toPersistentStore: and assign all things I want to whatever it is that's set up to store my things for me in a fresh Core Data app (the store I can't manage to 'find') - if that makes sense.


You're right about what's happening. When you add the in-memory store with the nil configuration parameter, you're specifying that you want all entities to be saveable to this store, so that's where we put them.


The easiest way to achieve what you want is to partition your entities into two configurations: stuffIWantSavedNoReally and memoryOnlyEntities. Then, you override NSPersistentDocument's (BOOL) configurePersistentStoreCoordinatorForURL:(NSURL *)url ofType: (NSString *)fileType error:(NSError **)error method (feel free to crib code from the CoreData Application template) to add both your stores, making sure to fill in the configuration parameter correctly.

And then everything should just work.

+Melissa


_______________________________________________ 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
References: 
 >Core Data: where is the default store in a CD-Document-Based-App? (From: Peter Laurens <email@hidden>)

  • Prev by Date: MiscKit, MOKit, etc.
  • Next by Date: Re: Uniform type identifier support in Cocoa or lack thereof
  • Previous by thread: Core Data: where is the default store in a CD-Document-Based-App?
  • Next by thread: RE:Core Data: where is the default store in a CD-Document-Based-App?
  • Index(es):
    • Date
    • Thread