Push notifications are working fine when using development certificates. When I switched to a production certificate in my ad-hoc distribution the app fails to register for push notifications. In the UIApplicationDelegate, neither didRegisterForRemoteNotificationsWithDeviceToken nor didFailToRegisterForRemoteNotificationsWithError get called. Additionally when I took a look at the device logs I found this:
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
My entitlements key in the provisioning profile looks like this:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>KUK8W9TW2G.com.startappz.ConversableDemo</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>KUK8W9TW2G.*</string>
</array>
</dict>
I have tried deleting the provisioning profiles from both Xcode and the portal and recreating them, I have also tried revoking the certificates and recreating them. I have even changed the app id and did everything from scratch.
I have also tried building with and without a separate entitlements file.
Update
I'm now debugging on the device using a distribution provisioning profile. The app now registers and receives push notifications successfully on the production servers, but still archiving the app breaks push notifications.
So now I'm almost sure Xcode is messing up something when archiving the app.
