No valid 'aps-environment' entitlement string found for application on app store

IosXcodeApple Push-NotificationsApp StoreEntitlements

Ios Problem Overview

So I have this app called Dripper that I put out about a month ago and then an update a couple days ago. The update added push notifications and a few little tweaks. I tested it with the sandbox-apn using the development profile and things worked great. Then I switched things to the production-apn and pushed it to test-flight, again things worked perfectly. Once I put update on the market and ran it I noticed I wasn’t getting any new push registrations on the server. I looked at the console logs for the device and found this:

>Dec 4 17:55:15 Ina-touch-it coffco[1210] : Registering for remote notifications
>Dec 4 17:55:15 Ina-touch-it SpringBoard[52] : No valid 'aps-environment' entitlement string found for application 'Dripper': (null). Notifications will not be delivered.
>Dec 4 17:55:15 Ina-touch-it coffco[1210] <Warning>: Failed to register with error : Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x174270900 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

I am a bit confused because I thought that the production-apn would function the same between ad-hoc and app store builds.

Here is my app id and its entitlements:

enter image description here

Here is the provisioning profile for the apps store:

enter image description here

Ios Solutions

Solution 1 - Ios

I fix this problem by enabling push notification capability.

Click on .xcodeproj -> Capabilities -> Enable Push Notification

Solution 2 - Ios

I fixed this issue like this:

  • Go to Xcode "Preferences"
  • Go to "Accounts" tab
  • Select my Apple ID and click "View Details"
  • Click on the arrow on the bottom left corner to refresh
  • Click "Done"

And try again!


Solution 3 - Ios

You must have to enable Target—> capabilities—> push notification. I have faced this issue using Xcode 8. enter image description here

Solution 4 - Ios

Such problems are due to current Provisioning Profile does not contain APNS information, as the Provisioning Profile is created BEFORE creating the APNS certificate.

Therefore, to solve the problem, create a new Provisioning Profile & select the Provisioning Profile in Xcode. Then you are DONE.

Also, when you add push, I believe you have updated the certificates in keychain too.

Solution 5 - Ios

Navigation for adding push notification capabilities has changed slightly on higher versions of Xcode. Here using 12.2

Xcode 12 add notifications capabilities instructions

Solution 6 - Ios

Regarding Xcode 9, some of the answers are outdated or incomplete to solve this specific issue.

Here was the steps to follow for me:

1. Create the Provisioning Profile

(FCM is not a prerequisite for push notification but their guides are amazingly clear, here is the link)

To test your app while under development, you need a Provisioning Profile for development to authorize your devices to run an app that is not yet published on the App Store.

  1. Navigate to the Apple Developer Member Center and sign in.
  2. Navigate to Certificates, Identifiers and Profiles.
  3. In the drop down menu on the top left corner, select iOS, tvOS, watchOS if it's not already selected, then navigate to Provisioning Profiles > All.
  4. Click the + button to create a new Provisioning Profile.
  5. Select iOS App Development as provisioning profile type, then click Continue.
  6. In the drop down menu, select the App ID you want to use, then click Continue.
  7. Select the iOS Development certificate of the App ID you have chosen in the previous step, then click Continue.
  8. Select the iOS devices that you want to include in the Provisioning Profile, then click Continue. Make sure to select all the devices you want to use for your testing.
  9. Input a name for this provisioning profile (e.g. Firebase Sample App Development Profile), then click Generate.
  10. Click Download to save the Provisioning Profile to your Mac.
  11. Double-click the Provisioning Profile file to install it.

2. Activate Push Notification capabilities

  1. Go to project editor, from official manual enter image description here
  2. In capabilities section, Activate Push Notification enter image description here

Solution 7 - Ios

I had the same problem using iOS 8.0 and above versions; I didn't get the device token and was giving error: "no valid 'aps-environment' entitlement string found for application"

I fixed it by using below steps

  • I have created new provisioning profile for the app id
  • added it into xcode
  • project Go to Xcode "Preferences"
  • Go to "Accounts" tab Select my Apple ID and click "View Details"
  • select your provisioning profile
  • Click on the arrow on the bottom left corner to refresh
  • Click "Done"

and now run the project definitely it'll work.

Solution 8 - Ios

For some reason Wei's solution was not working for me. When clicking the Fix entitlements, Xcode generated two files and it still did not function, indeed the generated entitlements files were empty.

This was caused (apparently) by the PRODUCT_NAME of the project being rather long and including spaces and "ä" and "ö" letters. After changing it to a short version with english-only letters the fix by Wei worked correctly.

Solution 9 - Ios

It took me a while to figure out what causing no valid aps-environment entitlement error. The problem was that there were two .entitlements files in XCode project. One is platform/ios//.entitlements and another one is platform/ios//Resources/.entitlements and the appropriate entitlements is present in the former file only while XCode is configured to use the latter. I updated the latter file manually and everything started to work. Another option to fix this is to change which .entitlements is used by XCode. This can be done in Build Settings --> Signing --> Code Signing Entitlements config param.

I'm not sure why there are two .entitlements files in XCode. Could it be that the cordova push plugin created the second one (i'm developing a hybrid cordova mobile app)? And what is the correct location for the .entitlements file?

Solution 10 - Ios

I experienced this issue and resolved it with the first solution.

However, I have failed once because I had two apple accounts logged-in. After removed one, everything became working.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJessiahView Question on Stackoverflow
Solution 1 - IosweiView Answer on Stackoverflow
Solution 2 - IosErwanView Answer on Stackoverflow
Solution 3 - IosRam G.View Answer on Stackoverflow
Solution 4 - IosFahim ParkarView Answer on Stackoverflow
Solution 5 - IosDariusLauView Answer on Stackoverflow
Solution 6 - IosmicaballView Answer on Stackoverflow
Solution 7 - IosVenky ChittalaView Answer on Stackoverflow
Solution 8 - IosOwlOCRView Answer on Stackoverflow
Solution 9 - IosAlex RyltsovView Answer on Stackoverflow
Solution 10 - IosDesen GUOView Answer on Stackoverflow