Emmy
Emmy

Reputation: 3999

The executable gets signed with invalid entitlements in Xcode

I got this error with Xcode when I try to run the app on my device.

The executable was signed with invalid entitlement

It worked fine with old Xcode Anyone knows how to get rid of the error?

enter image description here

Upvotes: 120

Views: 122274

Answers (30)

KimchiDamon
KimchiDamon

Reputation: 1

I had this problem cuz of scheme.

I've tried so many ways, but I figured out by myself suddenly lol

Edit scheme > Profile > Build Configuration : Debug > Close > cmd + I

Upvotes: 0

Rafał Sroka
Rafał Sroka

Reputation: 40030

Restarting Xcode was what worked for me

Upvotes: 80

Sam YC
Sam YC

Reputation: 11617

The error message from xcode app installation sometime can be very misleading, I have aligned the entitlements many times, but the root cause is not because of that, it is because I have changed the certificate and my build pipeline script was using wrong certificate SHA value:

/usr/bin/codesign --force --sign 701BB03735D5960C855D6E79223414F93F40065E --entitlements $workspace/xxx.app.xcent --timestamp=none $workspace/xxxx.app

for my case, nothing's wrong with my entitlement file, it is because 701BB03735D5960C855D6E79223414F93F40065E is wrong, but the error message always print out as The executable was signed with invalid entitlements. Wasted my whole day for this.

Upvotes: 1

MrHim
MrHim

Reputation: 421

Even if it could seems an easy fix, i solved it updating my iphone' s ios version. EDIT because of downvote: all answers i have seen talk only about xcode update. It was strange because of my old ios version was ios 13.3.3 and it worked on another iphone with ios 13.6. After updating to ios 13.7 it worked.

Upvotes: 0

iGW
iGW

Reputation: 643

This could be due to running distribution/release scheme. Changing the scheme to debug works for me. We can check the scheme here. Hope this helps someone.

enter image description here

enter image description here

Upvotes: 3

MD.
MD.

Reputation: 1167

I'm using Push notification in my app and after development completed i was try to test push notification for release configuration. At that time i got this error.

I was using Production Provisioning Profile to run for release. So i was able to solve this error by using Adhoc Provisioning Profile.

Upvotes: 1

Manthan
Manthan

Reputation: 3914

I think your problem lies because of the profile that you were using xCode4.6 and now you are using xCode5.

You need to refresh certificates/provisioning profiles via XCode > Preferences > Accounts

XCode > Preferences > Accounts > Click on your DEV ACCOUNT > View Details button (bottom right) > Signing Iden/PPs screen appears > hit Refresh.

Then choose again from build settings the correct profile and clean and build your project.

Hope this helps you.

Upvotes: 12

Saurabh Bisht
Saurabh Bisht

Reputation: 408

This could be due running wrong scheme as well.

Upvotes: 2

Papon Smc
Papon Smc

Reputation: 688

If this problem same me.You maybe forget set team in unittest in your target project try do this picture

enter image description here

Upvotes: 4

Daniel Lizik
Daniel Lizik

Reputation: 3144

I simply went to apple dev portal, downloaded the appropriate provisioning profile and reinstalled it (xcode 10.1)

Upvotes: 0

Jose Rojas
Jose Rojas

Reputation: 3520

I had a similar issue when I updated to Xcode 10, I solved the issue going to File > Project Setting, in the "New Build System" option select "Legacy Build System". This made the trick for me, I hope this helps to someone.

Upvotes: 5

Chen Xing
Chen Xing

Reputation: 1695

For XCode 10, one may need to use the legacy build system

Change can be made from File/Project Settings. ERROR ITMS-90174: "Missing Provisioning Profile - iOS Apps must contain a provisioning profile in a file named embedded.mobileprovision."

A cordova / ionic annoucement: https://github.com/apache/cordova-ios/issues/407

Upvotes: 19

Reinhard Männer
Reinhard Männer

Reputation: 15217

For those who have the same problem with Provisioning Profile Automatic in the targets Build Settings:

Be very careful when you edit your targets entitlements file! This might break the correspondence to the automatically generated provisioning profile, and you will get this error.

In my case, I had to use temporarily the iCloud production containers with debug builds. To do so, I inserted

<key>com.apple.developer.icloud-container-environment</key>
<string>Production</string>  

in the entitlements file and this worked!
To remind me that I had later to remove these lines, I further inserted simply the following comment:

<key>TODO</key>
<string>The entry below must be out commented or deleted to use the iCloud development environment.</string>  

And this broke the correspondence, and created the error.

Upvotes: 1

webmariner
webmariner

Reputation: 31

I was getting a similar error in Xcode 8.3.2. In my case, I found that removing the cached provisioning profiles from ~/Library/MobileDevice/Provisioning Profiles made Xcode download the correct one from the Developer Portal again and thereafter it worked first time. Hope this helps someone else!

Upvotes: 0

ingconti
ingconti

Reputation: 11636

All said above is correct, especially by Bartłomiej Semańczyk: re-recheck entitlements settings in Dev Center AND in your project.

my two cents for Xcode 9/ iOS 11..

If You add new entitlements for NFC (valid only for iOS11 / Xcode 9) in your repo where you also have an Xcode 8 project, Xcode 8 WILL fail.

So in case you use multiple projects with the same base code (with conditional compilation) sharing the same non-code files, be SURE to differentiate entitlements files between different Xcode version.

Upvotes: 0

Krish Wadhwana
Krish Wadhwana

Reputation: 1544

I grappled with this issue for an hour, and finally found a fix. Turned out the Development Team was different in ProjectTarget and ProjectTests.

Upvotes: 114

Matej Ukmar
Matej Ukmar

Reputation: 2235

No solution worked for me until I've checked and set app Tests target to same provisioning profile as main app. Or if you are using automatic singing make sure you have same team selected in Tests target.

Upvotes: 19

Radek
Radek

Reputation: 11

I came across exactly the same issue quite recently. After reading many different advices which none of them worked for me, I finally went under the hood and found the root cause of the issue.

Mobile provisioning file actually DOESN'T match with the Entitlements file generated by Xcode.

Although all files are anaged automatically by Apple tool, they are not correct.

If you download provisioning file from Apple portal and open it (you can open it because it's just plist file signed by your certificate, so it's readable by text editor) and compare it with your Entitlements file (automatically generated by Xcode and residing in project files (so it's again plist XML file readable by text editor). Then you can see the difference.

In my case it was Game Center entitlement. It was displayed on the portal as checked (checked by default) but actually this entitlement was not included in mobile provisioning file. So it was matter of deleting it from Entitlements file.

So the result is - content of mobile provisioning profile sometimes doesn't match with what is displayed on the APP ID configuration page.

Upvotes: 1

CupawnTae
CupawnTae

Reputation: 14580

Another thing to check - make sure you have the correct entities selected in both

Targets -> Your Target -> Build Settings -> Signing

and

Project -> Your Project -> Build Settings -> Code Signing Entity

I got this message when I had a full dev profile selected in one and a different (non-developer) Apple ID selected in the other, even with no entitlements requested in the app.

Upvotes: 3

Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61774

The solution for latest Xcode:

First you have to check what is enabled in your Member center for your specific AppID:

enter image description here

Then in your appropriate target in Xcode you have to enabled the same capabilities: In this case: App Group, Game Center, In-App Purchase. All of them have to be enabled in your target in Xcode.

enter image description here

However it doesn't matter for DEBUG mode:

enter image description here

it very matters for your RELEASE mode: enter image description here

Note that Game Center and In-App Purchase are enabled by default in Member Center but are disabled in Xcode's target.

Upvotes: 12

Ishaan Sejwal
Ishaan Sejwal

Reputation: 690

First and foremost make sure the correct provisioning profile is selected for the configuration that you have selected before building if you have manually set the provisioning profile. If you have set automatic as your provisioning profile make sure the correct provisioning profile is being picked up by Xcode while building.

Upvotes: 0

Danboz
Danboz

Reputation: 561

In my Case, i had to accept the Apple Developer License Agreement.

Login to apple developer account and observe the notification message similar to below.

"The Apple Developer Program License Agreement has been updated. In order to access certain membership resources,**** must accept the latest license agreement by June 28, 2016."

Earlier, i was not able to add/edit iCloud Containers to the App ID though i changed/checked Capabilities, Provisioning Profiles, Certificates etc. After agreement to the contract, things started working smoothly.

Hopefully, it would save someone's valuable time.

Upvotes: 1

e1985
e1985

Reputation: 6279

(Xcode 7.3.1) I had this issue with only one device in particular. What fixed it for me was to run the app from a colleague's computer(successfully) and after that I stopped getting this error on my computer.

Upvotes: 0

Smeedge
Smeedge

Reputation: 190

If the other good answers listed here aren't working for you, try opening Keychain Access and removing all 'iPhone Developer...' certificates other than the primary one you're using for code signing. I found that I had several revoked certificates, and certificates from my other teammates that needed to be deleted.

Upvotes: 0

Amit Saxena
Amit Saxena

Reputation: 596

I faced same issue. For me solution was below steps.

  1. I went on developer account i uploaded push certificate in App Identifier.
  2. Regenerate provisioning profile

Conclusion: If there is any service enabled but it's not configured then eigther disabling or configuring that service might solve the problem

Upvotes: 0

Xavi Valero
Xavi Valero

Reputation: 2057

In my case, the device wasn't added. So I had to add the device and generate a new provisioning profile.

Upvotes: 3

BillChan
BillChan

Reputation: 85

In my case APNS certificate is expired, remove the expired certificate and regenerate the provisioning profile fixes the issue.

Upvotes: 1

jdero
jdero

Reputation: 1817

The answers here seem a bit inadequate so I'm adding my two cents:

The real solution is that there is generally a mismatch between what is stored in your provisioning profile (check at developer.apple.com -> members -> certificates -> the cert you're using [be sure to check if dev/production) and what is enabled in your app (double click project name), under horizontal menu select'Capabilities' (next to 'General').

If you've recently changed one of these, be sure to refresh your certificates under XCode -> Preferences -> Accounts -> Details -> Refresh Icon and restart XCode.

Upvotes: 1

Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61774

It seems to be a little bug inside Xcode. Try to archive it anyway, even there is a problem with entitlements. If your entitlements are fine, it will be uploaded without any problem. Apple accept it, and your app will be published to the AppStore.

I did it, and it worked:)

Upvotes: 2

Maxwell
Maxwell

Reputation: 6822

Simple clean-and-build seemed to fix it for me.

Upvotes: 4

Related Questions