Open pavel-ship-it opened 4 years ago
I am surprised no one is assigned to this issue. Getting the same problem here. This makes it very inconvenient to work with embedded objects. In my case there are two levels, which makes it even worse. It also differs from the behavior in the Android SDK.
This is specifically related to realm.add()
, which the Android SDK does not have.
Any news on this? I've changed some models to benefit from embedded objects only to have the app crash all over now because of this :/
I fixed this in my app by converting the object to a dictionary/json representation and then using that as the parameter for value in let unmanaged = SomeObject(value: objectValue)
.
Would be great if we didn't have to do these workarounds and the SDK would do it on its own
@onelogapp so this is a work in progress yet, right? in my case, i get Cannot set a link to an existing managed embedded object
when trying to update my Object
with an EmbeddedObject
field
Crash during upsert of an existing object with a list of EmbeddedObject inside.
Goals / Expected Results
I can upsert a record.
Actual Results
Exception: Terminating app due to uncaught exception 'RLMException', reason: 'Cannot add an existing managed embedded object to a List.'
Steps for others to Reproduce
Create unmanaged copy of existing object with the property - list of EmbeddedObject's children objects. Try to add it with
UpdatePolicy.update
Workaround
Create a deep copy of a target object.
Code Sample
Stack trace
Version of Realm and Tooling
Realm framework version: 10.1.2 Xcode version: 12 iOS/OSX version: 14 Dependency manager + version: SPM