Why same iCloud account but got different ubiquityIdentityToken

923 views Asked by At

i am trying to implement an App with iCloud Key-value storage feature.

Currently, I'm testing it from two devices iPhone5s with iOS7.0.4 and iPhone4 with iOS6.1.1. Do you guys have any idea why the same iCloud account (checked from Settings -> iCloud -> Account) gets two different ubiquityIdentityToken? i guess this is the reason the data didn't sync between this two devices (network accessed).

And on iOS6, NSUbiquitousKeyValueStoreDidChangeExternallyNotification is not trigging.

Thanks in advance!

3

There are 3 answers

0
Rinat Khanov On

This is strange behaviour. In these cases Apple usually recommends signing out and logging again (using the same Apple ID) on both devices. Try that and see if it helps. Also, make sure to install the latest version of your app (with enabled iCloud) on every device.

1
Tom Harrington On

The ubiquityIdentityToken is only intended to be used to:

  • Determine if iCloud is available to your app
  • Determine if the iCloud account has changed (by comparing to a previously saved value).

It's opaque but conforms to a few protocols. You can save it locally and compare the current value with a previous value, but that's about all it's good for. It's not guaranteed to be useful in any other situation.

It's not guaranteed to be the same on different devices, even if those devices use the same iCloud account. Why it might be different is not documented-- it might encode a device-specific value somehow. Regardless, it's not something that you can transfer from one device to another and expect to still be useful. That's not how it's designed to work.

0
Peter Johnson On

It does encode a device-specific value in the token. The 8-digit hexadecimal number groups between positions 17 and 22 change on a different device OR with a different iCloud account.

The rest of the groups usually remain the same, across different apps, devices, OR iCloud accounts.