问题
I'm having a problem integrating iCloud with my app.
When I set test out iCloud availability, I receive Success for the function
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:@"AppID"];
but right after this, when I attempt to perform:
NSUbiquitousKeyValueStore *iCloudStore = [NSUbiquitousKeyValueStore defaultStore];
I receive the error
NSUbiquitousKeyValueStore error: no valid com.apple.developer.ubiquity-kvstore-identifier entitlement.
Any ideas on how to fix this? My App.Entitlements file is using the default macro'd prefixes, nothing changed from the auto-generated file. iCloud is definitely enabled on the AppID in iTunes Connect.
Thanks.
回答1:
I had the same problem even though all of my code, settings, entitlements, etc were correct. I fixed it by physically deleting the app from my iPhone, then building in Xcode and running it on my iPhone and it worked. Just wanted to add that in case the other solutions don't work for somebody else out there.
回答2:
Big warning: if your device is jailbroken, make sure you have uninstalled AppSync. I had two insane days because of that. iCloud (and Game Center) would not work on device with AppSync installed even with correct entitlements and profiles!
回答3:
I did the follow to get this to work for me (Xcode 4.2.1):
- In Xcode, go to your target > Summary > at the bottom, click Enable Entitlements.
- In the iOS Provisioning Portal, go to App IDs and enabled iCloud support. (You may not have to do this, but it worked for me.)
- Edit your Provisioning Profile to force it to update; then download this profile and open it so it automatically launches in Xcode.
- Clean and build your app to your device.
回答4:
I ran into this problem when attempting to debug a Mac (not iOS) application. The problem turned out to be that I was not signing the debug build, and did not have the deployment phase of the project with "Skip Install" set to "Yes".
Apparently, iCloud will not function properly with an unsigned application.
回答5:
Add com.apple.developer.ubiquity-kvstore-identifier
in your Entitlements with the following value:
$(TeamIdentifierPrefix)$(CFBundleIdentifier)
来源:https://stackoverflow.com/questions/8097174/nsubiquitouskeyvaluestore-error-no-valid-com-apple-developer-ubiquity-kvstore-i