Missing Push Notification Entitlement warning
Asked Answered
B

8

70

We have created an App ID, distribution certificate and provisioning profile. Push Notifications were not initially enabled.

We now need to implement Push Notifications in the app.

We have enable Push Notifications in the App D, check the provisioning profile, the provisioning profile was invalid, updated it, and downloaded the latest provisioning profile to use it for next time.

We then integrate the APIs for Push Notifications via APNS in our code.

After uploading the app in iTunesConnect, we get the following email from Apple:

Dear developer,

We have discovered one or more issues with your recent delivery for "Swanvi". Your delivery was successful, but you may wish to correct the following issues in your next delivery:

Missing Push Notification Entitlement - Your app appears to include API used to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement. See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

We have re-checked the App ID. Push Notifications are enabled for development and production.

In the Provisioning Profile, the Push Notifications option is shown.

Why are we getting this warning via email?

Banksia answered 14/1, 2015 at 14:43 Comment(7)
I can recommend you to go through #10987602Eurythmic
Thanks for your response. I have gone through the reference, but not so fruitful for me, I have done all the stuff as written there. The app is in waiting for review stage, will that app rejected?Banksia
Well about a year and half ago, this would be reason to reject app. I'm not so sure about now, because I think that a lot of app validation now goes on when you "validate" app in organizer. So if it went through, you may have a chance to get approved, but don't count on itEurythmic
Btw, there are plenty of advices regarding aps-environment like #14807629 or #5719682Eurythmic
Hi. @Bis, I am facing same issue right now. My application status is "waiting for review". Can you please suggest me that what should I do? And moreover I am not using any push notification in my iOs application.Participate
Request to Apple again. It will be accepted.Banksia
@Banksia could you please check if my answer is correct for your question? If yes, you could make it the right answer and help other developers trying to fix similar issues.Fatso
F
49

You need to see 2 things: The provisioning profiles used by your account on Xcode and the ones on developer.apple

Its all about the provisioning profiles.

STEP 1: Go to https://developer.apple.com/account/ios/certificate/ and see the Active iOS Distribution Provisioning Profiles you need for your app. Then click on it and make sure Enabled Services has Push Notification enabled. If it doesn't then click on edit and enable it by following the steps provided by Apple. If it is enabled then perfect.

distribution link

STEP 2: Delete any Invalid Provisioning Profiles you see related to app (just the invalid ones for YOUR app). I'll tell you why in the following steps.

STEP 3: Go to Xcode -> Preference -> View Details (for your Account) -> [OPTIONAL: To be sure invalid one is gone, rt-click on any provisioning profile, select "Show in Finder", then Delete/Move all the provisioning profiles from that folder.] Now click Download All Profiles. This will replace local provisioning profiles with current ones. Click DONE.

STEP 4: Go to your app Targets -> Build Settings -> In Code Signing, expand your Provisioning Profile to show Debug and Release tabs. By default it will be on Automatic (which is why your app was probably automatically using the invalid profile that we just deleted in step 2). For Release, to be on a safer side, select the Active Provisioning Profile with enabled Push Notifications as seen on step 1.

That's it.

You shouldn't get any emails now.

Fatso answered 17/9, 2015 at 18:29 Comment(5)
How do I know which one is invalid? I see multiple profiles like "XC *", "XC Adhoc", "iOS Team ..." etc.Deepfreeze
@Deepfreeze XC profiles are the one created by XCode by default. You should use the one you want, in most cases it is the provisioning profile you create yourself using the correct app certificate. For me, "XC *" and "XC Adhoc" were either invalid or not the right provisioning profiles, so I deleted them. You can do the same...in no case would anything break, so don't worry. XCode will generate a new provisioning profile if needed.Fatso
The refresh button no longer exists. XCode 8Ung
@JamesO'Brien please click 'Download All' for XCode 8 and on. It does the same exact function.Fatso
Delete the problem provisioning profiles and create a new one to replace it on your local system, if you just created AFNs certificates recently, just like my case now.Optics
H
17

@Djeeraj V.S. is correct. Cordova added some conditional compilation to remove this requirement for apps that do not need Push notifications.

You could comment out the code in in Classes\AppDelegate.h as per this answer, but its better to add the compilation symbol DISABLE_PUSH_NOTIFICATIONS via the UI so you can continue to benefit from future Cordova upgrades.

I come from .NET background so i am familiar with conditional compilation but had to spend a bit of time working out how to get the compiler flag working in XCode.

Turns out the magic word here is 'Preprocessor Macro'. Here is how its done graphically via the UI (note that this the way its done in XCode 6.1):

enter image description here

Hope this helps other people out there in same situation.

Huehuebner answered 4/8, 2015 at 3:12 Comment(2)
The OP is trying to add Push Notification capabilities to a app that formerly did not support Push. This answer seems to be about removing Push capabilities that were mistakenly added.Holystone
Unclear why this answer is on this question - it definitely is NOT an answer to the question "We have enable Push Notifications in the App ID .. email about missing ...". Needs an explanation as to what it is an answer to, and why it is here. (Could stackoverflow have somehow glitched?)Palm
E
14

In my case I've just checked again 'Capabilities' page inside project properties and pressed 'fixed issue' in the correspond APNS menu. Now it have to look like this enter image description here

XCode 11. To handle press on Capability button (+)

enter image description here

Elah answered 29/11, 2016 at 19:8 Comment(6)
It is not enughAnselma
@Anselma , in my case it wasElah
Sorry, the end of my comment was not sent: I also had to copy the auto generated entitlements file to the root directory of the project.Anselma
@Anselma , so, you can write your own answer. It is not needed to downvote this answer if you found another solution.Elah
In XCode 10.1 they removed Push notification option from Capabilities. how can I turn it off?Medarda
@MohammadMirzakhani added new screenshotElah
M
3

I fixed that issue by below steps:

  1. Open your project with Xcode
  2. Click the Signing & Capabilities in Runner tab and then click the + Capability button. Type push in the filter field and press Enter.
  3. After adding the push notifications entitlement, the Runner.entitlements file will have been created in your project
Margemargeaux answered 15/3, 2022 at 6:54 Comment(0)
D
2

I had the same warning and here is how I solved it.

First of all, when you archive your project, under entitlements if you don't see aps-environment and your app uses push notifications, then you will get the warning mentioned in the question.

FIX STEPS

1- Make sure your distribution profile is valid in Apple's Portal. - If it's not, then regenerate it. 2- If your distribution profile is valid, then in XCode, navigate to Preferences and then click View Details. At this point under Provisioning Profiles, make sure you don't have invalid distribution provisioning files. If there are invalid ones, then make right click and move them to trash. If you don't have the valid one, then download it from the Portal. 3- Go to Build Settings -> Code Signing and for everything choose the distribution provisioning profile.

At this point if you archive, you can see aps-environment in your entitlements and the warning email won't come.

Desireah answered 28/1, 2016 at 16:4 Comment(0)
L
2

In my case, following practice worked. Xcode 9.2

  1. Disabled Automatically manage signing which appears in Build Target > Signing
  2. Import provisioning profile manually.
Levelheaded answered 19/12, 2017 at 2:36 Comment(0)
H
1

2021 Xcode 12.4

I had the similar issue.my app uses push notification. For older release I never got such email from Apple. I think there's some issue with the Automatically manage signing.
Solution Do the Manual app signing

  1. Disabled Automatically manage signing which appears in Signing & Capabilities
  2. Import provisioning profile manually. enter image description here
Heavy answered 23/2, 2021 at 14:55 Comment(0)
B
0

I have a cordova app, where I have had notifications previously, but wanted to remove it from the app. I tried following the above answers, but I still encountered this issue when I uploaded the build. I realized, that I had a plugin installed, who used the notification setting, and somehow kept some settings activated for notifications.

I solved the issue by removing the ios platform completely cordova platform rm ios, adding it again cordova platform add ios and making sure that the plugin was removed from the ios.json and fetch.json files.

Bruell answered 7/2, 2019 at 9:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.