Invalid entitlements error when adding push notifi

2019-04-13 02:48发布

问题:

I'm trying to add push notifications to my chat app following this tutorial: https://www.appcoda.com/firebase-push-notifications/

I've toggled Push Notifications to On in "Capabilities":

My provisioning profile is set up for push notifications:

I downloaded it, and double clicked it to install.

For Code Signing, in Target -> Code Signing:

And Project -> Code Signing:

Entitlements file:

When I ran the project it succeeded, then said "The executable was signed with invalid entitlements". Full error The entitlements specified in your application’s Code Signing Entitlements file are invalid, not permitted, or do not match those specified in your provisioning profile. (0xE8008016).

Thanks for reading.. Any help on this will be hugely appreciated!

EDIT: Additional Information

Using Xcode 8.2.1

  • In my App ID in the developers portal, Game Center, In-App Purchases, and Push Notifications are enabled. It's my understanding that Game Center and IAP are enabled by default.
  • I've tried turning GC and IAP On, and then Off again. Restart Xcode, clean, build. No luck
  • I've tried turning GC and IAP On, then regenerating my provisioning profiles, installing them, cleaning and building. No luck.
  • My Bundle ID matches everywhere.

回答1:

Delete any unknown entries in entitlements file, which are not added by you.

Example: you can delete keychainAccessGroup entry from your entitlements file, if that is not added by you intentionally.

Have a look at your test target, the Team identifier should be same for both Test and Main target. Courtesy: https://stackoverflow.com/a/40464055/2959346



回答2:

As your given information your app has enabled services for Game Centre, In-App Purchase and Notification.

and according to your entitlements settings that your app in Xcode doesn't have Game Centre as enabled. Check you entitlements setting once and try again, after enabling Game Centre there shouldn't be any problem.



回答3:

From your project settings, go to general then check the checkbox Automatically manage signing then select your team from below field! that's it!

You can refer the below screen shot,