Ergun Coruh
Ergun Coruh

Reputation: 385

Could not launch 'app' with iCloud container

I have an OS X app targeting 10.7 (Lion) platform. I use XCode 4.4 on a development machine where iCloud is enabled. The OS X version on this machine is 10.8 (Mountain Lion).

I have an APP ID that I enabled iCloud using the Developer Certificate Utility: com.company.appname. The utility shows a green tick next to iCloud label under description of the App ID.

From XCode Target/Summary tab I enabled Entitlements and added iCloud Container com.company.appname. Of course internally it is preceded by the team id in the Entitlements file: teamid.com.company.appname.

I also have a valid (green ticked) provisioning profile on my Mac with the same id:teamid.com.company.appname.

Derived Data locations is set to Relative from XCode/Preferences.

The app builds OK. But when I run it I get "Could not launch "appname". Permission denied." error.

If I remove the iCloud container id com.company.appname from iCloud Containers list box under Entitlements and build the app, it runs OK. But of course I cannot access iCloud container enabled for the app.

I have been working on this problem for the past 24 hours. I have read the guides; Developing for the App Store, App Sandbox Design Guide, and Entitlement Key Reference inside out. Yet I am stuck. What went wrong?

I am desperate and I will be grateful if you can help me.

Upvotes: 0

Views: 2975

Answers (1)

auco
auco

Reputation: 9579

I think the most likely problem is that the AppID, the Entitlement and your provisioning profile do not match each other. This can happen easily if you experiment a lot with those settings. It should work right out of the box if you create a fresh new project with valid settings, but it might get corrupted if you convert, change or edit existing projects.

Do not forget about the 10-digit prefix of your app bundle id. This is required, esp. for iCloud Key-Value-Storage!

  • Log into developer.apple.com, check the AppIDs tab
  • Create an AppID if necessary
  • Check the iCloud settings for this app
  • Note down the exact app identifier in the form ABCDE01234.com.domain.app
  • Switch back to Xcode, update your Provisioning Profiles and Entitlements in the "Teams" section of the "Devices" Tab in the Organizer
  • Go to the project settings, select the app target and search for "Code Sign"
  • Make sure the correct code signing identity is selected (see the application identifier above)
  • Go to the summary tab and put in your app ID
  • Open the Entitlements file and check if the right ID is in there as well.

Then it should work. Hopefully.

Edit: thought it would be nice to add the link to the app id center: https://developer.apple.com/certificates/index.action#bundlelist

Upvotes: 1

Related Questions