11

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.

Rich Byden
  • 509
  • 2
  • 6
  • 13
  • How recently have you generated/downloaded/installed your development provisioning profiles? Once you check the "iCloud Enabled" setting in the dev site, you have to re-generate your profiles. Also, what does your Entitlements.plist file contain? – Craig Otis Nov 11 '11 at 18:18
  • I had just generated a fresh provisioning profile and set it up right before I posted this, so I'm definitely not using the outdated provisioning profile. My entitlements.plist appears to be missing, I'll look into that and see if it fixes anything. Thanks. – Rich Byden Nov 11 '11 at 22:26
  • 4
    It really was as simple as adding an Entitlements.plist file, making sure it had a Can Be Debugged - NO entry, and now it all works like gypsy magic! Thank you good sir. – Rich Byden Nov 11 '11 at 22:54
  • Awesome! You might as well post your solution as an answer. Glad things are working. – Craig Otis Nov 12 '11 at 12:16

5 Answers5

16

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.

Jackson
  • 3,555
  • 3
  • 34
  • 50
5

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!

Tertium
  • 6,049
  • 3
  • 30
  • 51
  • 1
    I had a problem with In-App Purchase feature, your advice saved me. Thanks a lot. I now receive a non empty products list! – grandouassou Sep 14 '12 at 08:40
3

I did the follow to get this to work for me (Xcode 4.2.1):

  1. In Xcode, go to your target > Summary > at the bottom, click Enable Entitlements.
  2. 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.)
  3. Edit your Provisioning Profile to force it to update; then download this profile and open it so it automatically launches in Xcode.
  4. Clean and build your app to your device.
jwhat
  • 2,042
  • 23
  • 29
  • 1
    In XCode 6 it's a bit simpler: go to Target > Capabilities > iCloud and turn it on. Xcode should take care of the rest. – Nick Jan 20 '15 at 08:20
2

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.

bfulgham
  • 159
  • 2
  • 3
1

Add com.apple.developer.ubiquity-kvstore-identifier in your Entitlements with the following value:

$(TeamIdentifierPrefix)$(CFBundleIdentifier)
pronebird
  • 12,068
  • 5
  • 54
  • 82