UserRecordID between iOS and macOS apps

Hello,


I'm creating a set of applications with transparent login based on the UserRecordID of CloudKit. Everything was working perfectly until I realized that you can't upload iOS and macOS applications with the same Bundle ID.


The problem is that the UserRecordID is not the same if you change the Bundle ID.

Is there any way to make it the same for all apps (iOS, tvOS, macOS) or upload iOS and macOS app with same Bundle ID?


Thanks!

Replies

Is the problem the userRecordID being different or that you are accessing completely different default databases from two different apps? You need to direct the apps to use a shared space not their defaults. You do that on the Capabilities page.

No, the problem is that the userRecordID is different.

I want to make a unique-transparent login for the user using the userRecordID. All works without a problem in dev, but I tried to create a same bundle ID for iOS and macOS apps but I can't. If I chage the bundle ID, userRecordID changes...

I admire your certainty. If it is accurate then why don't you insert a field into that userRecord and store an app-generated UUID in that field? Use that app-generated UUID as your unique-transparent ID.


But....if your belief that the two records are the same is actually incorrect, that by changing the Bundle ID you are accessing a different area of CloudKit, then go back and read my original answer.

Mmmm... interesting approach.


I have only one question: If I insert new field with generated UUID on private database, this field is unique and not deleted even if user deletes the app form your devices?

And if the user install the app again, this generated UUID on private database stills live? I'm right?

(always considering that the CloudKit container does not change)

>I want to make a unique-transparent login for the user using the userRecordID.


You might have more luck generating a token (DIY server managed) based on userRecordID and then apply it across apps instead.

I believe it remains unaffected by a delete and reinstall. You may want to explore storing a UUID in the user's key-value file in iCloud. It's much easier.


But again, I'm pretty sure you will discover that changing the Bundle ID changes the CloudKit data space unless you use shared space. These are different frecords in different spaces, not just different CKRecordID's

Thanks!