Submitting a binary for beta testing: “Missing Pus

2019-07-17 00:41发布

问题:

I'm currently using Xcode 6.4. In my Member Center site, I have both development and production APNS certificates for a certain App ID, and such App ID appears with Push Notifications enabled for both environments. I also created a couple of provisioning profiles: one for development with that App ID associated and Push Notifications in their enabled services, and another one for ad Hoc distribution for the same App ID and also with Push Notifications enabled services.

I can see both provisioning profiles in Xcode > Preferences > Accounts > Details list of provisioning profiles in my account, but the Push Notifications entitlement doesn't seem to appear there according to the entitlements icons displayed.

Moreover, when I archive the app and want to export for ad Hoc deployment, Xcode doesn't allow me to choose a certain provisioning profile to sign the app, even I had set it in target's Build Settings > Code Signing > Provisioning Profile. The app in that dialog also lists 4 entitlements for the archived app, but none is "aps".

Anyway, I exported the app by using the provisioning that Xcode set and doesn't allow me to change (XC Ad Hoc: *) and sent it to iTunes Connect. Then I received an email saying:

Missing Push Notification Entitlement - Your app appears to include API used to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement.

What could be happening? In my Member Center I have App ID enabled for push notifications, and I have the corresponding certificates and provisioning profiles. I refreshed the provisioning profiles twice with no result. What could I be mising? I really need help with this issue.

Thanks in advance

EDIT: If I open the provisioning profile in a text editor, it actually contains the lines:

<key>aps-environment</key>
<string>production</string>

Then why is this entitlement listed in Xcode > Preferences > Accounts icons of the provisioning?

EDIT 2: Should I add an Entitlements.plist file to my project? Where could I find documentation regarding that?

回答1:

I spent the last 2 weeks dealing with the same problem. And finally got it working. The problem is probably a bug in Xcode 6.4. Xcode was using a different Provisioning Profile to sign the App (the wildcard 'XC: *') which happens to not have the 'aps-environment' entitlement, even though I was selecting my provisioning profiles correctly in 'Build Settings' as you. So to workaround this I had to build and distribute via Shenzhen.

Hope this helps you too.