I wanted to give everyone a heads-up so you don’t waste a day like I just did…
When using XCode 4.2 and adding iCloud entitlements to an app make sure that you visit the iOS Provisioning Portal and check your App IDs to confirm iCloud is enabled (mine was originally, but for some reason was reset). Then generate new distribution provisioning profiles. Otherwise, you will get this error when trying to submit a build to iTunes:
Application failed codesign verification. The signature was invalid, or it was not signed with an iPhone Distribution Certificate
note. if you don’t want iCloud, simply clear the iCloud Key-Value Store and the iCloud Containers entries from the Entitlements section. That will work too.
Indeed very frustrating… not the best part of Xcode…
I am having this problem, but I have checked that the app ID has it enabled, which it does. Are you saying I need to create a new Distribution Profile? not just download the old one again?
EDIT
Never mind, that was exactly what I had to do. I had read that somewhere else, but I had misunderstood. I thought it meant to re download the distribution certificate after enabling iCloud, I didn’t realise I needed a new one