120

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

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
Emmy
  • 3,949
  • 5
  • 28
  • 30

41 Answers41

114

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

Krish Wadhwana
  • 1,544
  • 2
  • 12
  • 24
80

Restarting Xcode was what worked for me

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
  • 17
    So Xcode adopted the Microsoft universal fix. ;) For the record, this is still a problem and restarting is still the fix (I'm using v7.3.1). – Eric Soyke Aug 03 '16 at 14:34
  • 3
    another +1, face this problem again, then google it, I landed here. – jayellos Jan 06 '17 at 09:11
  • After hours of checking every single detail ... this worked in XCode 8 – Matej Ukmar Feb 10 '17 at 12:43
  • Does Anyone have a solid solution to this problem !!!!, All of these solution looks like some situational work arounds. Please help. – Max Apr 28 '17 at 09:38
  • Actually making project development team and project test development team same worked for me – Tahmid Rahman Dec 12 '17 at 07:18
  • XCode 9.2: Turns out this "fix" is still maintained by Apple :) IOW, The question, and this answer, are as relevant as ever – Oren S Feb 19 '18 at 16:49
  • +1 This also worked with Xcode 5.1.1 (we are maintaining an older enterprise app so still have use of this older Xcode version), and restarting Xcode solved the issue! – bluebinary Feb 26 '18 at 20:57
37

I found out the problem. The app I created on developer.apple.com does not include inter-app-audio. The project entitlements plist file on Xcode has inter-app-audio set to YES (by default). Once I changed the setting on my app configuration on developer.apple.com to enable the inter-app-audio. Then my app runs on my devices. I guess that is apple's new rule to make your app settings consistent on both developer.apple.com and your xcode project setting.

Emmy
  • 3,949
  • 5
  • 28
  • 30
24

I was able to fix this by toggling on/off "Game Center" entitlement in Xcode 5 :-)

Nik
  • 9,063
  • 7
  • 66
  • 81
19

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.

Matej Ukmar
  • 2,157
  • 22
  • 27
  • Very good point, this happens when you change your team in the main target but not in the test target. Changing the team in the test target to the team in the main target, solved the issue for me. – dan Mar 22 '18 at 09:15
  • Thanks!! This is what finally fixed it for me. Entitlements were a total red herring. – Reid Aug 10 '18 at 00:56
19

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

Chen Xing
  • 1,665
  • 2
  • 13
  • 13
  • 1
    would like add for Cordova/Ionic users that you may also need to change your generated Xcode project to use legacy mode by "File > Project / Workspace Settings" and change it to the Legacy Build system" as detailed here: https://stackoverflow.com/a/52605878/2503520 – Vyrnach Jun 27 '19 at 07:16
12

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.

Community
  • 1
  • 1
Manthan
  • 3,856
  • 1
  • 27
  • 58
  • 1
    Thanks for your help. I found out the problem. The app I created on developer.apple.com does not include inter-app-audio. The project entitlements plist file on Xcode has inter-app-audio set to YES (by default). Once I changed the setting on my app configuration on developer.apple.com to enable the inter-app-audio. Then my app runs on my devices. I guess that is apple's new rule to make your app settings consistent on both developer.apple.com and your xcode project setting. – Emmy Oct 26 '13 at 00:43
12

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.

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
6

I had to match the app's capabilities in Xcode5 under

Capabilities -> 
In-App purchase -> ON
Game Center -> ON

with that in the provisoning profile.

5

xcode 6.1 (HealthKit sample)

I was getting this error due to HealthKit integration: I had enabled In-App Purchase, Game Center and Healkit solved my issue.. The same I have enabled in Provision profile.

enter image description here

enter image description here

Vinod Joshi
  • 7,696
  • 1
  • 50
  • 51
  • Had to do the same for keychain sharing. I also had an app extension, I had to do it in both places to make it work. – CaseyB Dec 22 '14 at 20:35
5

(Xcode 6.1)

The problem for me was in my Build Settings; I had my Provisioning Profile set to an App Store Production Profile when trying to deploy to a device. I switched it to 'Automatic' and it resolved my issue. You could also set it to your Dev Provision Profile.

I also have 2 Certificates, so I added my second Certificate to my dev provision. Others probably won't have this problem.

Ian Newland
  • 1,574
  • 1
  • 18
  • 20
  • Thanks! Switching it to 'Automatic' did it for me – Emastmagy MastMagy Jan 30 '15 at 17:57
  • Strange that changing to automatic fixed it, but it worked for me. I had my provisioning profile set to com.mycompany.* and was getting this error. There were red FixMe under the Capabilities tab, but after fixing those issue I still received the invalid entitlements error. I then tried changing my provisioning profile from com.mycompany.* to automatic and it fixed the issue. I double checked that the bundleID is com.mycompany.blabla, so seems to be some sort of Xcode bug. I am using Xcode 6.3.2. – Jim Range Jun 15 '15 at 23:06
5

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.

Jose Rojas
  • 3,490
  • 3
  • 26
  • 40
4

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

Maxwell
  • 6,532
  • 4
  • 37
  • 55
4

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

enter image description here

Papon Smc
  • 576
  • 4
  • 11
3

I solve this by deleting all "PROVISIONING_PROFILE=..." and "PROVISIONING_PROFILE[sdk=iphoneos*]" = ... in project.pbxproj and restart Xcode and set provisioning profiles for the target again.

BabyPanda
  • 1,562
  • 12
  • 18
3

If restarting xcode doesn't work make a new provision profile and be sure to include your test devices.

matthias_h
  • 11,356
  • 9
  • 22
  • 40
mohammad alabid
  • 444
  • 7
  • 21
  • Restarting/cleaning didn't work for me, but then I realized I hadn't added my new test phone to the Ad Hoc profile I was using to build with. I regenerated/downloaded a updated profile and the error went away. Note: you may get a "security" error after doing this, which means the device needs you to authorize the app, just tap the app on device for the "trust developer" alert to activate. – SafeFastExpressive Apr 08 '15 at 20:52
3

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

Xavi Valero
  • 2,047
  • 7
  • 42
  • 80
3

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.

CupawnTae
  • 14,192
  • 3
  • 29
  • 60
3

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

iGW
  • 633
  • 5
  • 14
2

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:)

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
2

This could be due running wrong scheme as well.

Saurabh Bisht
  • 389
  • 1
  • 13
1

I had the same problem in XCode 5. This helped me anyway.

XCode > Preferences > Location tab > DerivedData

Press a little left arrow to open DerivedData in Finder. Move to trash folder of your project and rebuild.

Screenshot

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
Krešimir Prcela
  • 4,257
  • 33
  • 46
  • I guess there should be proper reasoning about why deleting derived data will solve the problem. – Kavita Nov 02 '17 at 09:35
1

Had some issue. Resolve: go to right target -> capabilities -> for me there was issue with "In-App Purchase" and button to fix it. Off-on operation fixed issue.

Anton Plebanovich
  • 1,296
  • 17
  • 17
1

In my case: I need enable Inter-App Audio in

Capabilities -> Inter-App Audio

I think because I use Parse.com Notification, it need link to AudioToolbox.framework

Nguyen Tran
  • 158
  • 8
1

Enabling Capabilities -> Inter-App Audio fixed this issue for me as well. I am also trying to send push notifications through parse

jstn
  • 1,862
  • 1
  • 13
  • 7
1

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.

jdero
  • 1,797
  • 3
  • 21
  • 36
1

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

BillChan
  • 85
  • 1
  • 3
1

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.

Danboz
  • 561
  • 1
  • 5
  • 14
1

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.

Radek
  • 11
  • 1
  • 2
1

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.

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
  • Where is entitlements file located? – Noitidart May 04 '18 at 17:52
  • It is in your project folder, and called "yourProject.entitlements". You can find it in Xcode's project navigator. – Reinhard Männer May 04 '18 at 18:26
  • Thanks. it seems it was not created until i checked then unchecked "inter app audio". I have game center and in app purchases on developer.apple.com but i dont use it, these are defaults. So I marked in my capabilities in xcode as "on" but no matter what i keep getting the "The executable was signed with invalid entitlements." error. :( – Noitidart May 04 '18 at 21:50
1

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.

MD.
  • 1,157
  • 11
  • 18
1

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.

Sam YC
  • 10,725
  • 19
  • 102
  • 158
0

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

Amit Saxena
  • 596
  • 7
  • 18
0

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.

Smeedge
  • 190
  • 1
  • 11
0

(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.

e1985
  • 6,239
  • 1
  • 24
  • 39
0

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.

Ishaan Sejwal
  • 660
  • 9
  • 29
0

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.

ingconti
  • 10,876
  • 3
  • 61
  • 48
0

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!

webmariner
  • 31
  • 3
0

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

Daniel Lizik
  • 3,058
  • 2
  • 20
  • 42
0

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.

MrHim
  • 401
  • 4
  • 16
0

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