ios - Do I have to save() my NSManagedObjectContext? -
i'm quite new ios development , have following question:
i'm using coredata , add element this:
nsentitydescription.insertnewobjectforentityforname("foo", inmanagedobjectcontext: moc) as! foo
after restarting app, it's still there. question is:
when should use nsmanagedobjectcontext.save()
function?
you call save when want persist changes disk.
your method inserts new object managedobjectcontext. managedobjectcontext temporary place put things. when create object in context, doesn't automatically persist changes persistent store until call save on it.
Comments
Post a Comment