Save individual Core Data object

Discussion in 'Mac Programming' started by MacDonaldsd, Mar 7, 2008.

  1. macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    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 ?
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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?
     
  3. thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #3
    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.
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    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.
     
  5. thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #5
    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.
     

Share This Page