Permanent IDs are now properly generated before save.
This commit is contained in:
parent
18657271ba
commit
f57de77545
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
||||
Subproject commit 8d3d345c4cc4c2630167d173767a856988c9d460
|
||||
Subproject commit d4bbb48f21af0323f887d8c869db90951e1f14f6
|
@ -372,12 +372,6 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
||||
// When privateManagedObjectContext is saved, import the changes into mainManagedObjectContext.
|
||||
[mainManagedObjectContext performBlock:^{
|
||||
[mainManagedObjectContext mergeChangesFromContextDidSaveNotification:note];
|
||||
|
||||
NSError *error = nil;
|
||||
if (![mainManagedObjectContext obtainPermanentIDsForObjects:
|
||||
[mainManagedObjectContext.registeredObjects allObjects]
|
||||
error:&error] || error)
|
||||
err(@"Failed to obtain permanent object IDs for all objects in main context: %@", error);
|
||||
}];
|
||||
}];
|
||||
|
||||
@ -423,12 +417,13 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
||||
element.type = type;
|
||||
element.lastUsed = [NSDate date];
|
||||
element.version = MPAlgorithmDefaultVersion;
|
||||
[context saveToStore];
|
||||
|
||||
NSError *error = nil;
|
||||
if (element.objectID.isTemporaryID && ![context obtainPermanentIDsForObjects:@[ element ] error:&error])
|
||||
err(@"Failed to obtain a permanent object ID after creating new element: %@", error);
|
||||
|
||||
[context saveToStore];
|
||||
|
||||
completion( element );
|
||||
}];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user