我发现了一个修复。我首先尝试了Xcode 6的示例项目,目标是iOS6(我需要保持iOS6的兼容性)。我有能力在这些设置:
这似乎是默认容器设置不只有键值存储工作。也就是说,使用上面的设置,ubiquityIdentityToken返回nil。
我接下来尝试检查CloudKit框,然后指定一个自定义容器。这可能工作除了我的iOS6兼容性问题。 CloudKit不适用于iOS6。
我又试图检查iCloud的文件箱;)(黑客我的方式向伟大?):
这将导致ubiquityIdentityToken返回非零!当我在我的实际应用程序中进行此更改时,与此测试应用程序相反,我的键值存储器再次运行! (它也适用于iOS8.1)。
我的授权文件的相关部分现:
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.$(CFBundleIdentifier)</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.$(CFBundleIdentifier)</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>