开发者

Updating a current CoreData entry

开发者 https://www.devze.com 2022-12-16 23:46 出处:网络
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 c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号