Open StKotok opened 3 years ago
Hi @StKotok , I would need more details to be able to help.
Hi @mentrena,
Can you reproduce the issue with the SyncKit example project?
I haven't tried it because my case isn't usual.
Can you provide code and steps needed to reproduce?
I reproduce this crash during synchronization data from the Apple Watch by both channels simultaneously: by iCloud and Bluetooth. During data synchronization with iCloud (via SyncKit), the same data piece (with the same personal key) received from the Watch via Bluetooth. It leads to the crash.
What version of SyncKit are you using?
0.9.0
I'm afraid that I would need to be able to reproduce the issue in order to come up with a solution. There is already a test to explicitly check that it's ok to create an object with the same identifier on two devices, so the crash is happening due to something more specific. I'm happy to have a look if you can upload a project to Github, ideally with the bare minimum code that reproduces the crash.
FWIW I've just reproduced this issue. I'll update on any findings
Ok, in my case it happens because I have a second process unrelated to syncing which also creates records locally that may already exist in iCloud. So SyncedEntity doesn't exist, gets created, and then fails when it tries to create the realm object with the data because it already exists. I've added merging logic to my fork.
Hello, It seems like Realm crashes the SyncKit.
Realm documentation says that it is possible to add a flag
.all
torealm.add()
, so that he would not crash but overwrite existing data.What do you think about adding an update
.all
flag torealm.add()
or raise an exception for handling it on the app side?Thanks!
Here are the logs: