PDA

View Full Version : Save individual Core Data object




MacDonaldsd
Mar 7, 2008, 05:59 AM
Hi,

As as far as I can see you can't save an individual NSManagedObject, you can just tell the NSManagedObjectContext to save all the changes.

Is there anyway round this ?



kainjow
Mar 7, 2008, 12:39 PM
I don't think so. Maybe you could use a different file format that doesn't require rewriting the entire file, like SQLite? Or are you already using that?

MacDonaldsd
Mar 7, 2008, 02:05 PM
Im using XML to save the data at the moment.

Basically the problem is, I have some RSS syncing in the application so when any new entries are added I want to save them automatically. But as this happens in the background, the user may be editing a file and I don't want that to save until the user decides they want to.

kainjow
Mar 7, 2008, 02:37 PM
Can't you delay the saving until they've done their editing?

With XML it'll always write everything every time, so you may want to choose a better format.

MacDonaldsd
Mar 7, 2008, 02:41 PM
Can't you delay the saving until they've done their editing?

With XML it'll always write everything every time, so you may want to choose a better format.

Yeah I think your right. Just its easier to see how everything is getting saved in XML.

Yeah I suppose that is an option, or do something fiddly with two ManagedObjectContexts and Merge them.