Reputation: 412
I have 5 levels (or even more) linked realm objects in my code. Projects, including sections, including tasks, including attachments and ...
I've found in some other questions that I should get the linking objects, like this:
private let sections = LinkingObjects(fromType: Section.self, property: "tasks")
var section:Section? { return sections.first }
This code solves the problem for the first parent. But for the grand parents(!) this return nil again. So this is not the ultimate solution.
Any better ideas?
Upvotes: 1
Views: 333
Reputation: 412
Turns out, all the objects should have primary keys in order to maintain relationships. Or they will lose the relationship after updates.
One of my objects in the chain, did not have a primary key.
Upvotes: 2