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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -