I noticed that line 72 of MRCoreDataAction is not set to notify the main context.
localContext.MR_notifiesMainContextOnSave = NO;
This is even the case for saving data in the background with saveDataInBackgroundWithBlock:
When I tried to relaunch the app (which is using the main context), the data is not merged to the main context, so it's empty.
Why is it done this way? How to save the data properly in the background so it would be available when the app is relaunched?
RIght, so in that case, we need to turn off the notification on the localContext because it is going to be dealloc'd at the end of that method. Doing this ensures that the notification it signed up for does not get sent to a dealloced object (causing a crash and instant mayhem). Setting this value to NO is required to avoid crashes.
No, you may not be getting saves occurring in the background for some other reason. Most likely, you may not be using the passed in context for your changes. Use the localContext the block provides for all operations.
There should not be any issues with saving in the background of which I'm aware.