The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements file do not match those specif
In my case, I had a duplicate Provisioning Profile with the same name. This was accidentally created when I added an share extension to my project, stash all of those changes with git, and created a new share extension with the same name (com.companyname.project.share-extension-name). Deleting the Provisioning Profile in the developer member center (developer.apple.com) fixed this for me.
In my case, the app main Target's Team was different from Tests' Target Team. Changing the Tests' Team to the same Team as main Target's solves the issue.
I had to delete all the provisioning profiles by following this article.
First of all, you should check bundle id, provision profile and certificate with private key (.p12).
If it doesn't help. Be sure that the Code Signing Entitlements has correct value or remove it at all.
One possible reason for this error is: your annual subscription has been renewed. Once the subscription is renewed, all devices related to the active provision profiles will be detached.
After this, rebuild project with Xcode and the error will disappear.
File > Workspace Settings > Build System > Legacy Build System
This worked for me. Xcode 10.0