Cloudkit data merge got duplicate

Hi, developer

I have face the duplicate issue while using cloudkit. I am using registration app. I use cloudkit for generate UHID also. Is cloudkit is good to generate UHID.

My problem,

Cloudkit automatically sync the data in background at the time user create new reg. Eg: Cloudkit had 20 data but in local it insert 11 data and is in progress at the user create new one, i fetch latest UHID and i get 11 at the time i get the duplicate. I use the deduplicate code also, but some times not helpful also if two user get reg data at the same time it get conflict.

Cloudkit data merge got duplicate
 
 
Q