Last active
August 29, 2015 14:10
-
-
Save penso/39eccc756e3efe9ab84c to your computer and use it in GitHub Desktop.
How to sync icloud coredata?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 Devices A and B, they both receive a push notification at the same time, | |
which triggers a fetch of an object on a remote server, and store the content | |
inside a coredata icloud enabled DB. The object has a PID stored on the remote | |
server. | |
You end up with 2 entries: one fetched on the remote server, one synced | |
from the other device through coredata sync. | |
Both devices have different NSManagedID for the same entries (you can't | |
automatically remove the most recent one based one it), the only thing you | |
can be doing is randomly removing duplicates after icloud sync, but that's not very | |
efficient. You may also remove the latest entry the user read. | |
I tried added an automatic updated_at for each update, but that doesn't | |
work either. My last idea is storing on the server a flag the item has already been | |
downloaded, and not store it on the 2nd device if it did. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment