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.