Search code examples
magicalrecord

Where should I call MagicalRecord.cleanUp() in my iOS app?


Where should MagicalRecord.cleanUp() be called in the App lifecycle? applicationWillTerminate() is not guaranteed to be called (for example if the user forcibly terminates the app, according to this).

Thanks!


Solution

  • It really depends on what you want to do. The cleanUp method was meant to remove all the default objects in the case you needed to rebuild your main stack. So, it could be the case that you would call this method when the app simply goes into the background, and resumes with a new stack. I think there isn't a single place you would use this method, which is why we didn't automatically wire it up to every device event.