I am not sure if this is a problem with master data or a problem with MagicalRecord.
My app uses MagicalRecord to help using CoreData. When the application starts for the first time after installation, when I save new objects, and then the application terminates and starts again, these objects are not. However, any new objects created after this first restart of the application are saved as usual. This only happens when the application is fresh and the database is empty. When the application starts once, although the database is empty (confirmed by adding the application and extracting the sqlite file and opening it on my Mac), it works from now on.
In my application, I do the following
[MagicalRecord setupAutoMigratingCoreDataStack]
The application saves the push notification messages it receives, so the application can display the activity that has occurred. Therefore, when a push notification appears, this code works
_currentNotification = [PNotificationEntry MR_createEntity]; _currentNotification.* = <new value>; // set all kinds of attributes [[NSManagedObjectContext MR_contextForCurrentThread] MR_saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error) { if (nil != error) { NSLog(@"failure to save notification entry"); } else { NSLog(@"successful save of notification entry"): } }];
I know this saves because logging magic records on the console shows that it is successful, and NSLog shows it, and more importantly, NSFetchedResultsController, which monitors the changes, picks up a new object and displays it.
But as soon as the application shuts down and restarts, not one of the objects that were inserted is in the sqlite file, and not one of them is displayed. But then again, as already mentioned, after the application was fired after installation, it now starts saving objects correctly, and you see the objects there in the next application launch.
It doesnβt matter if, at the very first launch after installation, the application tries to insert an object or not. The second launch of the application works correctly.
I do not understand what might happen.
The MagicalRecord version is the latest on github last week.