no valid 'aps-environment' entitlement str

2019-04-06 17:33发布

问题:

I've searched on Google and Stack Overflow, but I'm unable to resolve this problem.

My app has an AdHoc and Appstore provisioning profiles, both of which are giving the error "no valid 'aps-environment' entitlement string found for application" in my X Code console, and I'm unable to send push notifications. So far the steps I've taken are: - edited profile in development portal, downloaded new profile and inspected the .mobliprovision file. Found

aps-environment: production get-task-allow : false

I submitted it to the App store anyway, and it passed validation and it is awaiting review. When I inspect the binary detail in iTunes Connect portal, I can ses that aps-environment is listed as "production" as well

What could I be doing wrong?

回答1:

Did you create the provisioning profile AFTER you generated the push certificates from the Application ID you are using?

It is very likely you created the provisioning profile first and then generated the push certificates.

For future reference PushIO has a handy step-by-step guide to creating a PEM file that includes the warning about re-generating the provisioning profile after generating the PEM certificate :

http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCFA/ios/distribution-pem/



回答2:

It took me hours to solve it. Given that someone is using custom scripts to sign and pack while others are using xcode itself, there's only one way to check what ended in your app. Dump you entitlements with

codesign --display --entitlements :- path/to/MyApp.app

and check aps-environment and application-identifier.

You should also check that hose entries are in your profile and that they match