-
Notifications
You must be signed in to change notification settings - Fork 132
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
AutoCoding 2.2 + HRCoder does not encode relations into JSON #13
Comments
Can you post your project somewhere, and I'll investigate. Might be a problem with HRCoder, or it could be that relationships need to be handled in a different way, or something. |
Sure. Give me a moment to prepare that for you. |
Okay, @nicklockwood I've pushed the demo project up to https://github.com/fatuhoku/autocoding-demo. It uses Cocoapods so be sure to It's just loads of tableviews at the moment, so it should be intuitive to use. You can create a named continent, and named countries (and named languages... but that doesn't matter a whole lot right now. They're made to relate to each other. See the JSON representation by touching the "Compose" button. Thanks! EDIT: I would totally ignore the |
I would add that good test to make sure that |
I'll have a look into this as well. For the purposes of setting up testing for this you might find |
I've found that
However, when using |
Despite the changelog saying
relations (
@dynamic NSSet
s) aren't encoded properly.Reproduction
Make a simple model with two entities, with a To-One and a To-Many inverse relationships linking between them. Here, I've chosen
Continent
andCountry
as a simple domain.Suppose I want to store a
Continent
named "Europe", that is related to aCountry
named "France". I've stored this in a View Controller property calledself.continent
below. I'm using HRCoder to encode theContinent
object into JSON:Here, the JSON I get back is:
... no sign of the related
Country
! Why's that?Workaround
Use something like: https://gist.github.com/nuthatch/5607405That particular solution doesn't preserve object references.
The text was updated successfully, but these errors were encountered: