rollback coredata not working

Problem: 

I'm having one problem that while create i want save and discard option.While discard i want to rollback the unsaved changes.I tried but not working.After few mins only data rollback working.


Solution:

The above problem occurs because you used the context that was common also it was not reset the current context.Use the below code it was working fine.


                rollbackContext()

                getContext().reset()


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift