How can I get only unique record in coredata+cloudkit(NSPersistentCloudKitContainer) environment?

断了今生、忘了曾经 提交于 2021-01-24 20:25:10

问题


For example, I have a entity named User in public database of Cloukit. Every new user using the App will record his identity in it, and only one record.

But in coredata+cloudkit environment, there is a user, two apple devices, two this Apps, one cloud. Firstly, the user use this App on the phone A, check existence of User in local coredata when startup, not exist, so create a User record. It's ok. Days later, the user do the same on the second Phone B, record not exist in local(not sync from cloudkit), create another user record of the same user.

After a while, there are two records of the same user in both phone A and phone B, even in cloukit. how to avoid this?

The configuration/preferences is the same, I just want to keep my only one configuration for my App on all phones by syncing with private database of cloudkit. But for the same reason, There will be al least two.

So how can I get only one record in coredata+cloudkit environment?

来源:https://stackoverflow.com/questions/65527786/how-can-i-get-only-unique-record-in-coredatacloudkitnspersistentcloudkitcontai

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!