Search code examples
iosclient-serversynchronizationtokenicloud

iCloud GUID Across Devices


I'm trying to figure out a way to generate a unique iCloud ID that will be the same across devices. My app stores data in an online database that I would like to tie back to an iCloud id. This gives the nice user experience of not having to deal with logins (since all data is tied to their iCloud account), without being stuck using iCloud's lousy sync. The problem is that as far as I know, there's no API that will give me this kind of ID.

Things I've tried/thought about:

1) NSUbiquitousKeyValueStore

Doesn't work, because the value will get updated "sometime later" i.e. - whenever Apple feels like it.

2) iCloud Document Storage

Same problem as #1, with the added bonus of storing a random file in the device that the user can remove by hand

3) Using [[NSFileManager defaultManager] ubiquityIdentityToken]

Because the Ubiquity Token's bytes are the same for any given login session, I imagined it may be that this may be the case across devices. Not the case

4) Using the Address Book Contact

Seems like it would be unreliable (what happens if they change their main email/phone number/name), plus has the side effect of annoying/freaking out the user at first launch (how do they know I'm not stealing all their contacts?)

5) Rolling my own login system tied to a remote server

This seems to be the only option available, although I'd prefer a better one.

Thanks in advance


Solution

  • There is no persistent unique identifier for iCloud.

    Option 5 is your best bet unless you want to do conflict resolution on a sync'd file that uses document storage.