We've got some data coming into our app. Sometimes it will be saved, so we've made an entity and a NSManagedObject subclass for it. Usually, though, the objects will be instantiated and never saved. I'm thinking of using another persistent store, with the NSInMemoryStoreType, as a staging area, then moving the ones we want to save into the sqlite store. Is that possible/sensible?
If it is, I'd like to clear out the staging area every so often. Is there a way to clear out just the objects开发者_Go百科 assigned to the memory store?
You should read this lengthy blog post on temporary Core Data objects. It's very insightful.
http://www.cimgf.com/2011/08/08/transient-entities-and-core-data/
Can you not use the 'scratch pad' / Undo Management properties of core data? http://developer.apple.com/library/mac/documentation/cocoa/conceptual/coredata/Articles/cdUsingMOs.html#//apple_ref/doc/uid/TP40001803-207821-TPXREF148
精彩评论