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

This entry was posted in iPhone, Objective C, Programming and tagged , , . Bookmark the permalink.

7 Responses to APNS error – No Valid aps-environment entitlement

  1. Ben says:

    I did that but I’m still getting the error. Any other suggestions?

  2. Jon Smith says:

    @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.

  3. a guy says:

    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.

  4. a guy says:

    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.

  5. Creating a new profile after setting up the push notification certificate and quitting and restarting Xcode works for me.

  6. Susanna Caleklint says:

    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!

  7. Josh says:

    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 *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>