iOS - dreaded code signing error (0xE8008016) - push notifications - ios

Well I get this error:
The entitlements specified in your application’s Code Signing
Entitlements file do not match those specified in your provisioning
profile.
(0xE8008016).
I have checked that the bundle ID corresponds to the provisioning profile, and from what I understand, I enabled push notifications correctly for development on my app id profile (in the dev center).
Knowing that I am using push notifications, what do I need to do to resolve this?
I don't have push notifications certified for distribution, just development.

The solution was to first create a new app ID, change the bundle ID in xCode accordingly, and do the push notifications configuration first, before creating a provisioning profile, for both development and production.
Next I created a provisioning profile with the new app ID, and changed the bundle ID in xCode, downloaded the profile, and compiled the app.

Not using the entitlements file - removing it from the build settings did the trick for me. (Thanks Hetal!)

Related

Xcode 8.1 "Provisioning profile doesn't include the aps-environment entitlement"

Is anyone experiencing this problem?
After persistence problemas and information retrieval on the KeyChain I had enable
the KeyChain Sharing feature in Capabilities.
This was to create a file called .entitlements
So, when I gonna run the Archive this error occurs:
Check Dependencies:
Provisioning profile doesn't include the aps-environment entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'
I'm using OS El Capitan 10.11.6, Xcode 8.1
If anyone can help.
Pleaseeee....
Check the Capabilities tab on your target and make sure the Add the Push Notifications entitlement to your entitlements file shows a check mark (under Push Notifications). If it shows an error, fix and you should be good to go.
For my case, Xcode 9
Case 1:
I used fastlane match before I added push notification capability and entitlement file.
Solution 1:
Run fastlane match again. It will detect that the provisioning profile is no longer valid since you added capabilities and will regenerate again, and push to your repo.
Case 2:
I used fastlane match before I added push notification capability and entitlement file.
I regenerated the invalid provisioning profile in the developer.apple.com account manually. So when I ran match, I got error
Provisioning profile '4d89b10f-568e-400d-a4e9-c96e0a51fd46' is not
available on the Developer Portal for the user a#xyz.com Make sure to
use the same user and team every time you run 'match' for this Git
repository. This might be caused by deleting the provisioning profile
on the Dev Portal
this may also happen when you press Fix Issue from Xcode
Solution 2:
Step1: delete the invalid provisioning profile from your certificates repo
Step2: run
fastlane match
It can happen that you have two entries for the "Apple Push Notifications Service" in your Entitlements file. This seems to be a bug in XCode (even in v8.2), which it cannot resolve by itself.
Open your Entitlements file in the text editor of your choice.
I had the following duplicate entries in my Entitlements file:
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
Try deleting one of the two key-value pairs. For me, deleting the first entry aps-environment solved the issue.
When you add push notifications to your app.
If you already have a provisioning profile.
It will become invalid.
You have to go to developer.apple.com
Edit your provisioning profile.
Then download the newly created one and double click on the same.
XCode will automatically replace the last one which became invalid.
Also verify that the apple id that you created on the Developer portal (developer.apple.com) has Push Notifications enabled. I faced it when I created the provisioning profile before enabling push notification on the app id so I had to edit the app id.
Target -> Capabilities
Make sure the Add the Push Notifications entitlement to your entitlements file shows a check mark under Push Notifications.
If it shows an error, than fix it.
I just Quit xcode and open it again resolved my issue. xcode (Version 11.7 (11E801a))
Make sure your project Bundle Identifier matches the App ID certificate at Developer portal.
i added this to my entitlements.plist and it's done.
<key>aps-environment</key>
<string>production</string>
I use "ionic package" and this work for me:
Go to https://developer.apple.com/account/ios/identifier/bundle
Edit "iOS App IDs" checking "Push Notifications"
Go to https://developer.apple.com/account/ios/profile
Regenerate and download app "iOS Provisioning Profiles"
Resend ".mobileprovision" file to Certificates in ionic apps panel
Work again "ionic package..." command

iOS 8 - notifications stopped working in new Ad Hoc version

There are many threads already about this infamous error:
no valid 'aps-environment' entitlement string found for application
But the difference is that for me it was working perfectly before, and now the problem showed up again.
We updated the project for iOS8 in Xcode 6, and we created a new Ad Hoc distribution profile (Xcode got rid of the old one somehow), installed the ad hoc build with Testflight as we had before.
I tried to check for any trouble:
bundle IDs are correct
the App ID is properly configured to use notifications in production
the notifications certificate is still valid
the new AdHoc profile claims to have notifications enabled.
Nothing else seems wrong until the 'aps-environment' error (when the device tries to register for notifications). Could the new AdHoc profile mess this up somehow? Anyone has any idea of what can be the conflict?
Xcode 6 seems like automatically generate provisioning profile(XC Ad Hoc : ...) for you.
When you try to export ipa for AdHoc, see what bundle id the provisioning profile is using.
If the bundle id contains wildcard(*), it won't work for push notification.
In my case, I removed wildcard bundle id from my app ID list in certification center, and refreshed profiles from Xcode accounts settings. After that, Xcode generated AdHoc profile with full app ID, and push started working again in AdHoc version.

Need to force Xcode 5 to not use wildcard provisioning profile

I'm trying to use the new Automatic Configuration in Xcode 5 and it seems that when I run builds on my iPhone it is downloading the wildcard provisioning profile and using that to run the app. This is no good because my app uses push notifications and the wildcard will not have the correct entitlements to register for push notifications.
Is there a way to specify to use the provisioning profile for the qualified app id so I can test push notifications?
Strategies I have considered:
Delete wildcard app id - You cannot do this
Delete wildcard provisioning profile - Xcode will recreate the wildcard provisioning profile
Specify the provisioning profile explicitly in the target's build settings
I don't know how to determine the explicit name with Xcode 5. I could download and open the profile in a text editor, but that can't possibly be the right way to do this
If I specify the provisioning profile, I will need to update it every time a new profile is generated (add a new device, profile expires, signing certificate expires). This defeats the purpose of automatic configuration.
I've poked around Xcode looking for such a setting and haven't seen anything useful
I have followed the steps here (for configuring Push Notifications) and when I refresh my provisioning profiles they are not updated.
Any ideas?
Xcode was not downloading the provisioning profiles because it did not find any app id MATCHES. It did not find any matches because the capabilities in the "Certificates, Identifiers, Devices" website did not match the capabilities listed in the project in Xcode. Because the app identifier has In-App Purchase and Game Center enabled on the website but once I enabled it in the project it automatically downloaded the relevant provisioning profiles.
Hope this helps someone else.

Setting an Entitlements file - The executable was signed with invalid entitlements

As soon as I check "Use Entitlements File" in Xcode, I get the following error when I try to run my app on my phone:
The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements
file do not match those specified in your provisioning profile.
I'm trying to get iCloud working, and it seems like I'm failing on step 1. I can run in the emulator, but not in the device I provisioned automatically through the organizer.
What am I doing incorrectly here?
First of all, you need to have specific provisioning for your App's ID, matching its bundle ID. Even if it's only for development, generic Team Provisioning cannot work to test iCloud.
If the App ID had been issued without iCloud enabled, and updated afterward, related Provisioning must be updated also.
Often, provisioning updating from Xcode's organizer fails to bring the right one. In this case, I suggest you to try to download updated provisioning directly from iOS Developer Website.
In my case, I have added inter-app capability in my iOS project and Xcode automatically suggested to add this permission in the app id (bundle id) in the provisioning portal and I did so. After this
I thought it was fixed since Xcode was showing tick marks for all under inter-app audio sections as follows
Add the "Inter-App-Audio" entitlement to your APP ID
Add the "Inter-App-Audio" entitlement to your entitlements file
Link AudioToolbox.framework.
Actually it was not fixed and I had to generate another distribution certificate with inter-app enabled and only when I signed with that distribution certificate I was able to install the app.
You Need to have Developer Certificate And Private Key in your keychain And Provision profile that have created must match with this Certificate.

App rejected because of "Missing Push Notification Entitlement"

Recently my application got rejected while uploading it. The Apple review team says my app is "Missing Push Notification Entitlements"
This is the information they have provided:
Missing Push Notification Entitlement - Your app registers with the Apple Push Notification Service, but the application signature's entitlements do not include the required "aps-environment" entitlement. Make sure you have enabled Push Notification Services for this app, and that you have downloaded a Distribution provisioning profile that includes the "aps-environment" entitlement.
Earlier versions of my app used to have push notifications, and my app binary never got rejected due to that. What should I do here?
Open your Provisioning Profile in any Text Editor and search for "environment".
You should find: aps-environment
If you don't see aps-environment in your provisioning profile, there is an issue in your Apple provisioning certificate.
If you created a certificate without push notifications, and then later on you added Push Notification service, Apple DOESN'T update your provisioning profile.
You need to create a NEW provisioning profile. Sign the binary with this new Provisioning Profile and you would be good to go.
I have recreated my Distribution provisioning profile and build my application with it. This change fixed the issue of Missing Push Notification Entitlements.
If you are submitting a Cordova / Phonegap project and you are NOT using push notifications, you should inspect Classes/AppDelegate.m for the two methods below. Observed in Cordova 3.7.0, not sure about other versions.
Make sure you are not using remote notifications in any other way (carefully check your plugins as well). Then remove or comment out the following block:
- (void) application:(UIApplication*)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
// re-post ( broadcast )
NSString* token = [[[[deviceToken description]
stringByReplacingOccurrencesOfString:#"<" withString:#""]
stringByReplacingOccurrencesOfString:#">" withString:#""]
stringByReplacingOccurrencesOfString:#" " withString:#""];
[[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
}
- (void) application:(UIApplication*)application
didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
// re-post ( broadcast )
[[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
}
Hope this saves you a few hours ;-)
I had the same problem and I fixed it by recreating the provisioning profile. From "Provisioning and Development" in the Local and Push Notification Guide:
The Team Admin or Team Agent must next create the provisioning profile (Development or Distribution) used in the server side of remote-notification development. The provisioning profile is a collection of assets that associates developers of an application and their devices with an authorized development team and enables those devices to be used for testing. The profile contains certificates, device identifiers, the application’s bundle ID, and all entitlements, including . All team members must install the provisioning profile on the devices on which they will run and test application code.
My Case : I have implemented push notifications for an update to my appstore app. As the provisioning profiles prior to the push notification impelmentation becomes invalid, I have created new Appstore-distribution provisioning profile and built the app with new profile and uploaded to store. But I got a mail saying "Missing Push Notification Entitlement".
Finding : I found that while archiving, Xcode is using the wrong (invalid/old) provisioning profile. So deleted the old provisioning profile from member centre and it solved the problem
I received this same error message, and recreating my provisioning profile didn't eliminate it.
Instead I found that my app contained some stray APNS-related symbols (in a library) that weren't being used. Apparently they caused a static analyzer to mark the app as using push notifications (it doesn't). #ifdef-ing out the symbols allowed my app to be accepted without the aps-environment entitlement.
I also had this problem with a Cordova app and after doing a bit of reading it seems that this is a common issue nowadays.
WHY DID IT HAPPEN?
Since you mention that your app was already approved using push notifications, the most likely scenario is that the Provisioning Profile for your app was changed when submitting it to the AppStore. Perhaps you:
rebuilt your project in XCode, or
moved to another computer and forgot to tell XCode what the correct profile was, or
somebody sat on your computer and changed it, or
This issue happens because permissions are gleaned through the provisioning profile. If you forget to link the provisioning profile for your app to an AppID that has the 'Push Notifications' entitlement (Note that XCode does this automatically by using the wildcard developer provisioning certificate by default) then you are likely to get this message until you sort out the permissioning.
HOW TO REMOVE THE NEED FOR PUSH NOTIFICATIONS IN CORDOVA APPS:
I was submitting a Cordova app when I got this message, and while the solution posted by #jlapoutre is enough to get your app approved, you want to continue benefiting from Cordova upgrades so the best thing is to take advantage of conditional compilation (ie triggering the #ifndef DISABLE_PUSH_NOTIFICATIONS directive which tells XCode to compile you app with this bit of code left out).
Conditional compilation is also known as 'Preprocessor Macros' in XCode-speak. This is how the you can accomplish this 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.
I recently encountered this issue after adding a Today Extension to an app with Push Services enabled. Finally realized that the Mobile Provisioning profile generated by Xcode for the Today Extension did not have Push Notifications Services enabled. Once I enabled Push Services for the Today Extension, the warning from Apple went away.
Steps
Enable Push Notification Service (Production Push SSL Certificate)
Create/Recreate Distribution Provisioning Profile and build your
application with updated Distribution Provisioning Profile.
The following resources may help you
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html
http://www.raywenderlich.com/3443/
http://mobiforge.com/developing/story/programming-apple-push-notification-services
I have same problem. I have solved it.
I think this problem causes when adding push-notification-function into AppID and no recreating Provisioning.
We will receive a warning when adding iCloud-function:
All new provisioning profiles you create for this App ID will be enabled for iCloud. If you wish to enable iCloud for any existing provisioning profiles associated with this App ID, you must manually regenerate them
I think when we add some function in AppID, we should manually regenerate all provisionings which are related to that AppID.
I think so

Resources