I\'ve read Where does xcode take application's Identifier from? , XCode bundle identifier formatting from {PRODUCT_NAME} , and loads more but...
I\'m trying to g
Make sure you have selected correct. Provisioning Profile. I found that I was trying with Team Provisioning profile.(for application identifier: *) Further down in the list, there was correct one for the app.
I just figured this out after a few hours, so in addition to what JulianB said,
I found this question when I was moving from a development environment to a production one on an application that I am working on. This process involved the creation of a new profile, a new app ID, etc. I created the app ID and a profile, but the Team Agent had to configure the push notifications. I ran into the problem of "no valid 'aps-environment' entitlement string found for application" when I tried to resume testing with the new profile (after the app had been configured for push notifications). I then remembered reading a little caveat in the documentation:
"You have to modify the profile in some way (for example, toggle an option) for the portal to generate a new provisioning profile. If the profile isn't so "dirtied", you're given the profile without the push entitlements."
Source: Local and Push Notification Programming Guide
For me, "dirtying" the provisioning profile and reinstalling it was all that was needed to fix the issue. Per the documentation, this was required because the provisioning profile was created before the app was configured for push notifications. This may or may not help anyone, but this probably explains (and eliminates) the need to manually add anything to the provisioning profile.
I ran into the same "no valid 'aps-environment' entitlement string found for application" problem, but the above solutions did not work for me.
I could not find very good documentation about this error or even just the key "aps-environment".
After some tinkering around, here is what solved the problem for me:
Open your development provisioning certificate, "Appname.mobileprovision" with a text editor, look for the key "Entitlements" then add all of the values found here to your Entitlements file referenced by your Code Signing Entitlements setting.
Here is an example of what keys/values you'll find inside:
<key>application-identifier</key>
<string>xyz.com.xyz.xyz</string>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>xyz.*</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>xyz.*</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>xyz.*</string>
</array>
After adding all of these values to my Entitlements file my app builds successfully and I can finally get back to working on Push Notifications.
I'm not sure if these values are supposed to be automatically added to your entitlements file by XCode, but they certainly weren't being generated for me in my project.
Using XCode4 and receiving the same "no valid 'aps-environment' entitlement string found for application" I had to do the following:
My solution was to remove and create again Development Provisioning Profile. It was listed as "Invalid" - not expired and also renew failed (Xcode 4.3.2 and iOS 5.1)