I am going to start updating this to help those seeking to use this as reference for their own personal code.
Newest update
Excuse me Slev, I've got the same problem that you have when you say that the app is crashing because the iCloud data will attempt to merge immediately into the device (where the device has not yet set up its persistent store) but I can't understand how have you solved this.
Your code is :
- (void)mergeChangesFrom_iCloud:(NSNotification *)notification {
if (self.unlocked) {
NSManagedObjectContext *moc = [self managedObjectContext];
[moc performBlock:^{
[self mergeiCloudChanges:notification forContext:moc];
}];
}
}
I haven't tried it yet but looking at this code I wonder what happen to the notifications that arrive when "unlocked" is false. Would you loose them?
Wouldn't it be better to have a while loop that test the "unlocked" property and spend some timespan until the property becomes true?
I hope you will understand my very bad english... :)
Thank you
Dave