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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -