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 get push notifications going and getting the dreaded
"Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x15b200 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}" error.
I'm fairly certain I've followed all the steps correctly, including:
The only think I can't quite get my head around is the Bundle Identifier
The push certificate is for
XXXXXXXXXX.com.julianbaker.pwcnewsuk
The Bundle Indentifier in PwCNewUK-Info.plist is for
com.julianbaker.${PRODUCT_NAME:rfc1034identifier}
If I manually change it to
com.julianbaker.pwcnewsuk
I get a UDID mismatch error as the app is seen as PwCNewsUK
When I've Googled this there seems to be some confusion over the matter, but it seems they have to match?
QUESTION:
What should the Bundle Indentifer be to match the push certificate of
XXXXXXXXXX.com.julianbaker.pwcnewsuk ?
QUESTION:
Do I need to add a "aps-environment" entitlement to the provisioning profile, and if so where and how? (See http://www.airplaysdk.com/node/3174 amongst others)
Loving iPhone development but sheesh it can be a headbanger at times!
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.