-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught exception when syncing a to-many relationship #280
Comments
Thanks a lot for reporting this issue, sadly at the moment I'm really busy at work. Hopefully I'll get time to have a look at this issue early next week, I hope that's ok for you. Have a good weekend! But as always PRs are very welcome, if there's something hard to understand I can take some time to give some guidance. |
@pwestrich Could you help me by saying what are you using for primary key in each entity? |
Working on a fix here, but need more info to reproduce: #290 |
busId is the primary key for both Bus and Route, and index is the primary key for RouteStop and RoutePolylineItem. |
@pwestrich Thanks! |
Hi again @pwestrich I haven't been able to reproduce the issue. Do you have any idea what I might be missing? |
I'm not sure. From what I can see your managed object model and JSON look like mine. I'm nowhere near my work computer at the moment. I'll see what I can do Monday morning when I'm back. |
@pwestrich Don't worry! Have a great weekend 🎉 |
@pwestrich I was able to reproduce the bug by calling Sync two times, one after the other. Seems like the crash is related to updating. |
I do have two calls to Sync, but removing the second one has no effect; it's the first one that causes it, which is the one that updates the Route and its subset of objects. |
Issue fixed here: #290 🎉 Should be available through CocoaPods in the upcoming Sync release. |
Awesome. Thanks a lot. |
Since attempting to update to the latest version of Sync (2.0.0) and Xcode (8.0), from 1.12.3 and 7.3 respectively. I have been experiencing a crash due to an uncaught exception.
It happens at NSManagedObject_Sync.swift:185. It appears that one of my managed objects (ICRoutePolylineItem) is being asked for the key "busID", which it has never had, let alone has it been a primary key. Here's my managed object model and an example of the JSON being synced:
Normally, the JSON would have more specific addresses and coordinates, but I removed them for the purpose of example. I have ensured that the managed object model properly maps remote primary keys to their appropriate local ones, as I had to match the mapping given to me form the remote server. I haven't modified those mappings for a while, and it did not manifest itself until updating to version 2.0.0, so I don't believe that is the issue.
I feel that Sync is confused as to which entity it is wanting the primary key from, because the other end of the relationship has the primary key it's looking for, but not this one.
The text was updated successfully, but these errors were encountered: