mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
[CoreStore: Error] NSManagedObjectContext+Transaction.swift:203 saveAsynchronouslyWithCompletion #213
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tosbaha on GitHub (May 4, 2018).
I am using ImportUniqueObjects extension to import data from the server. If the Store is empty import works but if there is a previous data, following error comes
I know code 1560 is validation error but why it works in the first time but not the second time puzzles me. Error code also shows that parent is nil.
Here is the relevant models
@JohnEstropia commented on GitHub (May 5, 2018):
@tosbaha If I'm interpreting your error message correctly,
I think the issue is that the moment this line is executed,
the old
KargoDetailCDinstances get theirKargoDetailCD.parentset tonil. You probably have a "required" constraint for theKargoDetailCD.parentrelation.Either you remove this requirement, or you delete the old details before you assign new ones. I would recommend the latter so your sqlite file don't get polluted with orphaned records.
@tosbaha commented on GitHub (May 5, 2018):
Thanks a lot! I really appreciate your dedication to this project. I added below code and error is gone.
PS:
It is not related to this question directly, but is there a way to have a Uniqueness by using multiple fields. Because for this user case, I don't have any ID to differentiate. Something like Hashable protocol maybe?