Categories
iPhone Objective C Programming

APNS error – No Valid aps-environment entitlement

If you get the following error when trying to register for a device token, firstly ensure you have correctly followed the directions within the iPhone Developers Portal.

Error Domain=NSCocoaErrorDomain "no valid 'aps-environment' entitlement string found for application"

If after you have verified your Provisioning Profile and application settings you still get the error, try the following:

Go to the Project Settings in the Project Menu

APNS Error 1

Select the exact Code Signing identity for your application rather then the automatic selection.

APNS Error 2

8 replies on “APNS error – No Valid aps-environment entitlement”

@Ben
The only other thing is to redo to Provisioning Profile. I think that if you apply for the Dev Cert and then immediately generate the Provisioning Profile you can get this error, as the certificat isn’t ready by the time the profile is genereated.

i had set up my provisioning profile properly (it has to be one that was created using the AppID you created for push notifications) – and it was still giving me this error.
I quit Xcode and restarted and then it worked.

ran into this again (on another app), and restarting xcode didnt help.
So I did this and it worked.
– deleted old profiles from phones/xcode and in the program portal
– selected dont code sign.
– cleaned all targets
– quit xcode
– created new profile in program portal, downloaded it, and double-click it in finder which installed it in xcode.
– opened by project, selected the new profile
– build and run
– it then asked me to install the profile on the phone and then the registering for push worked.

so (in conclusion) I think the same that Jon Smith answered (recreating your provisioning profile) is the proper way to fix it.

Thank you so much! Have been banging my head against the wall for a while before I found this. I could kiss you right now. 🙂 Thank you again!

In my case, it caused by code sign “Release”. code sign only “Debug” and not “Release” fixed it.

Reloading xcode and cleaning the code worked for me. As a note clicking on refresh under Xcode/Organiser/Provisioning profiles also helped. It then asked for my developer.apple.com username/password to download the IOS Team Provisioning profiles.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.