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 -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -