We have created an App ID, distribution certificate and provisioning profile. Push Notifications were not initially enabled.
We now need to implement Push Notificatio
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.
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.
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.
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.
@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):
Hope this helps other people out there in same situation.
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
XCode 11. To handle press on Capability button (+)
In my case, following practice worked. Xcode 9.2
Automatically manage signing
which appears in Build Target > Signing