Question

I am encountering this error when I am loading an Ad Hoc build of my Push Notification enabled iPhone app onto my device:

no valid aps-environment entitlement found for application

What does it mean, and how do I repair it?

Was it helpful?

Solution

I found the solution. In my project info under Build > Code Signing Identity I had it set to automatic, and it was selecting an AdHoc distribution profile which did not have push notifications enabled. (It was the wrong one.) I have selected the correct profile and the error is gone.

OTHER TIPS

Push Notifications must be enabled for your App ID before creating a Provision Profile.

So, in this order:

Create your APP ID

Enable APNS

Create the Provisioning Profile

In my case Xcode had invalidated the provisioning profile (it will say so in the Member Center).

What worked was to refresh all the provisioning profiles in Xcode after enabling Push for the app in the Member Center.

Here is Apples guide to refresh all the provisioning profiles on your computer. https://developer.apple.com/library/prerelease/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingProfiles/MaintainingProfiles.html#//apple_ref/doc/uid/TP40012582-CH30-SW26

In short open Xcode and do the following:

  1. In the Xcode Preferences window, click Accounts.

  2. Select your team, and click View Details.

  3. In the dialog that appears, click the Refresh button in the lower-left corner under the Provisioning Profiles table.

    Xcode updates the list of profiles in the Provisioning Profiles table.

You have to enable Target—> capabilities—> push notification. I have faced this issue using Xcode 8.1.

enter image description here

Generate a Provision Profile specific for your App ID (Push Notifications Enabled), do not use the widlcard ones

I kept going through the process over and over again with one mistake... the Provisioning profile i kept on using was DEVELOPMENT this WILL NOT WORK

you NEED to use ADHOC provisioning profile

if you didn't write the original code and aren't 100% sure on how it works, make sure that you have it set up to receive the right type of push notification token. had a problem where the app i was working on was only set up tokens on a release build. it's worth a try if nothing else works and you think your code is set up properly -- find the steps online somewhere to do a ad-hoc build and try it

It'll work even with a development profile but if you add in APN (Apple Push Notifications) after the fact make sure to go into member center and open the provisioning profile again (my said invalid), just opening it and closing it made it valid again and then I updated my profiles in Xcode via settings and everything worked just fine.

In my case, I renamed the App. So the provisioning profile was generated for the old App-ID. All I had to do, was to change the App-ID and add an new provisioning profile with the new App-ID.

For IONIC USERS:-

CAUSE:- If you are running your app in iphone using "ionic run ios" then this will also cause the same problem. SOLUTION:- instead you must run your ios app using XCODE to install app into iphone.

SOLVED MY PROBLEM!!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top