I'm in the process of integrating AFIncrementalStore into my project but I'm having a hard time figuring out how to make relationships work.
Let's say I have two models: Document and Page. A document has many pages (one-many). Each model has an inverse relationship to the other.
So I can do:
myDocument.pages
or
myPage.document
I'm trying to fetch all the pages that belong to a document. I have an AFIncrementalStore subclass and an AFHTTPClient subclass that implement the necessary methods.
I can see that the right REST URI is called (eg. /documents/:id/pages). I can also see that the pages get downloaded and stored into the pages table in the sql database.
The problem is the relationship between the two isn't made. When I look at the DB the foreign key column is empty.
Also if I do myDocument.pages it doesn't return anything.
Do I have to manually link these two when new data is fetched? I'm reading through the AFIncrementalStore source but nothing is sticking out.
Thoughts?