Destroying an object in Core Data before it's saved

隐身守侯 提交于 2019-12-11 07:56:24

问题


If I create a new Custom Object in Core Date (using Magical Record) like so

List *list = [List MR_createInContext:_managedObjectContext];

And then I perform various actions on it, such as setting its name

list.name = @"Foobar List";

But then the user decides to cancel the creation of this list, do I need to delete? As in, is this list already in memory even though I haven't saved the local context with [localContext MR_save];


回答1:


If you create the object in the managed object context, it will get saved the next time you save changes. If you don't want to save it, you'll have to delete it.



来源:https://stackoverflow.com/questions/17801648/destroying-an-object-in-core-data-before-its-saved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!