In Realm, what's the right way of creating a new object, without creating a new object for one of its relations?
Let's say I have the object Person
with a one-to-one relation to the Job
entity.
My code writes first 10 Jobs
objects and then creates 10 other Person
objects with the previously created objects.
Since the Person
didn't exist before, the flag for update
is false.
realm.add(person, update: false)
But since the Job
object already existed it throws the follow exception:
Terminating app due to uncaught exception 'RLMException'.'Can't set primary key property '' to existing value ''.'