How do you update a 开发者_运维问答existing core data entry?
Simply modifying a managed object does not cause the changes to be saved to a store. The managed object context acts as a scratchpad. You can create and register managed objects with it, make changes to the objects, and undo and redo changes as you wish. If you make changes to managed objects associated with a given context, those changes remain local to that context until you commit the changes by sending the context a save: message. At that point—provided that there are no validation errors—the changes are committed to the store. As a corollary, simply creating a managed object does not cause it to be saved to a persistent store, and deleting a managed object does not cause the record to be removed from the store—you must save the context to commit the change.
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html#//apple_ref/doc/uid/TP40001803
To update a core data entry, just fetch the entry you desire, make the necessary changes, and finally call :save on the managed context.
精彩评论