阅读背景:

为什么同样的iCloud帐户却有不同的ubiquityIdentityToken

来源:互联网 

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

我正在尝试使用iCloud键值存储功能实现应用程序。

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).

目前,我正在使用iOS7.0.4的两款iPhone5s和iOS6.1.1的iPhone4进行测试。你们有谁知道为什么同一个iCloud帐户(从设置 - > iCloud - >帐户检查)得到两个不同的ubiquityIdentityToken?我想这就是数据在这两个设备之间没有同步的原因(网络访问)。

And on iOS6, NSUbiquitousKeyValueStoreDidChangeExternallyNotification is not trigging.

而在iOS6上,NSUbiquitousKeyValueStoreDidChangeExternallyNotification不会触发。

Thanks in advance!

提前致谢!

3 个解决方案

#1


7  

The ubiquityIdentityToken is only intended to be used to:

ubiquityIdentityToken仅用于:

  • Determine if iCloud is available to your app
  • 确定您的应用是否可以使用iCloud

  • Determine if the iCloud account has changed (by comparing to a previously saved value).
  • 确定iCloud帐户是否已更改(通过与先前保存的值进行比较)。

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.

即使这些设备使用相同的iCloud帐户,也不能保证在不同设备上保持相同。为什么它可能不同没有记录 - 它可能以某种方式编码特定于设备的值。无论如何,它不是你可以从一个设备转移到另一个设备并期望仍然有用的东西。这不是它的设计工作方式。

#2


0  

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.

它会对令牌中特定于设备的值进行编码。位置17和22之间的8位十六进制数字组在不同的设备上或使用不同的iCloud帐户更改。

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

其他组通常保持不变,跨不同的应用程序,设备或ORCloud帐户。

#3


-1  

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.

这是一种奇怪的行为。在这些情况下,Apple通常建议在两台设备上注销并再次登录(使用相同的Apple ID)。试试看,看看它是否有帮助。此外,请确保在每台设备上安装最新版本的应用程序(启用iCloud)。


分享到: