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

1111. appearing after print sequence - php -

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

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -