Saturday, December 17, 2011

iCloud Gotchas

Integrating iCloud with core data was easy when I found this tutorial, but I ran into few issues while implementing and testing it on devices. And here are the steps how I managed to solve it.


Issue 1:


The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.


(0xE8008016).

If you create a new application Id and enable iCloud then you miss the adventure. It seems enabling iCloud on existing account provide different identifiers for key value store from app identifier.

And editing .entitlements file with Xcode adds some extra identifiers i.e., {APP_IDENFITIER}

Text is an awesome format, don't ruin the beauty with IDE/ plist editors.

Solution to this problem is, copy for key entitlements from your mobile provisioning file and paste the same in place of in your entitlements file.

appname.mobileprovision


appname.entitlements


Issue 2:

2011-11-21 22:57:35.770 appname[6338:1c03] *** -[NSFileManager URLForUbiquityContainerIdentifier:]: An error occurred while getting ubiquity container URL: Error Domain=LibrarianErrorDomain Code=11 "The operation couldn’t be completed. (LibrarianErrorDomain error 11 - The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.)" UserInfo=0x1b14b0 {NSDescription=The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.}

If you see this issue then your missed to update [nsfilemanager fileManager URLForUbiquityContainerIdentifier:@"with your valid identifier"] in your appdelegate

NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:@"3JCZ6A8BSY.com.yoursite.appname"];

Other common issues are

  • Forgot to turn on wifi when your device is in airplane mode (It beats me every-time)
  • Forgot to switch to your developer certificate from distribution to developer signing (code signing)

4 comments:

  1. It's interesting that you menton error 11, this seems to be a bug within iCloud that only two websites have really found:

    https://www.google.com/search?q=%22LibrarianErrorDomain+error+11%22

    Unfortunately your recommended fix isn't helping in my case. I've set-up a parallel app with the exact same UbiquityContainerIdentifier which compiles and syncs with iCloud just fine, but my original app still runs into error 11.

    ReplyDelete
  2. @matt

    may be you should try adding com.sitename.appname instead of ID.*

    ReplyDelete
  3. Yeah - found my fix by doing a line-by-line step through and finding the line where URLForUbiquityContainerIdentifier was being reset to NIL after I had assigned it. Problem solved :)

    ReplyDelete
  4. You have helped me fixed Both the gotchas. Obviously there is some issue on my part in understanding the terms for icloud integration and this has shed light on that.

    Thank you

    ReplyDelete