drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

Removing from set doesn't remove from other devices, causes re-add #283

Open joshbirnholz opened 5 years ago

joshbirnholz commented 5 years ago

I have a countdown app that allows you to put countdowns into different categories. The Category class has a to-many relationship with a Countdown, so a countdown can be in more than one category, or none.

When I add a countdown to a category, it gets added to the category on other devices as well, just as I'd expect.

However removing a countdown from a category doesn't work correctly. Removing a countdown from a category triggers a sync. On the other device, a sync is triggered, but the countdown is not removed from the category on the other device. Another sync then occurs on the other device, which then triggers a sync on the first device. The countdown gets re-added to the category on the first device.

I'm not sure what I'm doing wrong or what's causing this.

Videos of this happening: https://imgur.com/a/5759Ae6

easiwriter commented 5 years ago

I had a similar problem once. It turned out to be unique ids. Do your entities have a unique id across devices and do you let ensembles know about them?

drewmccormack commented 5 years ago

There was a case recently where someone had created the globalIdentifier delegate method, but it wasn’t being called because it wasn’t exactly the right name. Also worth using the @objc attribute for all the delegate methods, and checking they are called using a breakpoint.

Drew

On 18 Apr 2019, at 22:58, Josh birnholz notifications@github.com wrote:

I have a countdown app that allows you to put countdowns into different categories. The Category class has a to-many relationship with a Countdown, so a countdown can be in more than one category, or none.

When I add a countdown to a category, it gets added to the category on other devices as well, just as I'd expect.

However removing a countdown from a category doesn't work correctly. Removing a countdown from a category triggers a sync. On the other device, a sync is triggered, but the countdown is not removed from the category on the other device. Another sync then occurs on the other device, which then triggers a sync on the first device. The countdown gets re-added to the category on the first device.

I'm not sure what I'm doing wrong or what's causing this.

Videos of this happening: https://imgur.com/a/5759Ae6 https://imgur.com/a/5759Ae6 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/drewmccormack/ensembles/issues/283, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAS4AEPGLJFY7OMSFKFJ7LPRDOIDANCNFSM4HHAJAVQ.