Xcode 8.1 "Provisioning profile doesn't include the aps-environment entitlement"
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
repoStep2: 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.