283

Since yesterday I've been getting the following error when trying run an app on my device:

A valid provisioning profile for this executable was not found."

This is after updating to Xcode 10. Building with Xcode 9 last week worked without issues. I've checked the other discussions about the error, but none of the solutions works.

The issue isn't limited to a single project I've been working on as it affects several all from different signing teams.

So far I've tried the following:

  • Cleaning project

  • Cleaning derived data

  • Uninstalling Xcode, deleting any preferences and files related to it.

  • Installing Xcode on a completely different Mac

  • Testing with different devices

  • Disabling device in developer profile and letting Xcode enable it again.

  • Deleting all certificates in the developer portal and recreating them

  • Unchecking and rechecking "Automatically manage signing"

  • Trashing the provisioning profile and letting Xcode recreate it

  • Creating a manual provisioning profile in the developer profile

The project contains no tests so there can't be a problem with wrong signing settings on that target. Date / Time is set to Automatic

One thing of note is that no Provisioning Profiles are listed here, except for the manual one I created: https://developer.apple.com/account/ios/profile/

I'd expect the xcode generated one to show up as they do for all other clients.

Below are the signing settings I'm currently using

provisioning profile settings

I've yet to try downgrading Xcode to an older version to see if that works. Other than that I have no idea of what to try next.

8
  • Have you added the developer account in Xcode preferences? Sep 20, 2018 at 12:17
  • @AnkitJayaswal Multiple times, never got it to work. I was able to solve it however by downgrading to 9.4.1, so the issue seem to be related to Xcode 10 somehow. You should be able to submit apps with the old Xcode version for a while right? Sep 20, 2018 at 12:37
  • 2
    Yes you can submit the builds from xcode 9 and its version until March 2019 developer.apple.com/ios/submit Sep 20, 2018 at 12:38
  • Also I tried with Xcode 10 as well and I am not facing such issues of missing provisioning-profile. Sep 20, 2018 at 12:39
  • 5
    Did you change your iPhone date past the expiry data of your certificate? I faced this issue due to this reason. Jun 12, 2019 at 10:27

38 Answers 38

515

I was struggling with this today, it was super frustrating. For now, just go into "File" > "Project Settings..." (or in some cases "Workspace Settings...") and then select "Legacy Build System" from the "Build System" dropdown.

15
  • 19
    But what does this mean? What effect does it have and how do we know we can change the settings again?
    – Siyah
    Oct 1, 2018 at 18:47
  • 4
    This worked on a Cordova build-- excellent work. Evidently the Cordova CLI has an argument to skip: cordova build ios --buildFlag='-UseModernBuildSystem=0' See more here: github.com/apache/cordova-ios/issues/407
    – Victor
    Oct 9, 2018 at 22:03
  • 8
    There is no Project Settings under File. I had to click on Workspace Settings, and then select "Legacy Build System" from the Build System Dropdown in the Shared and Per-User Workspace Settings.
    – red-devil
    Nov 19, 2018 at 5:44
  • 14
    Not work for me :((.My Xcode Version is 10.1. My iPhone OS version is 12.1 Dec 2, 2018 at 10:46
  • 3
    I am using xcframework which absolutely needs new build system, so I can't change to legacy build system!
    – chengsam
    Apr 23, 2020 at 4:19
111

[edit] Note 2020: I used to manual sign this project. In projects where I automatically signed, I never had this issue. [/edit]

I had the same problem, and spent hours searching for an answer, removing profiles, cleaning project, and so on.

Have you distributed your app? You need to switch back to your developer profile, but not in General under the project settings, but in Build settings.

Under Signing, look at your Code Signing Identity.

Make sure that both your Debug and Release are set your iOS Developer, and not iOS Distribution; or your iOS Developer Provisioning profile, if not set to the automatic values.

The same goes with Provisioning Profile. It should be your developing profile, and not your distribution profile. enter image description here

12
  • To clarify (because I was confused by this recommendation when I first read it): this change of release to iOS Developer is only while testing directly on an attached device; will need to change back to iOS Distribution when build for uploading to testflight/app store, right? Nov 22, 2018 at 20:18
  • 1
    In all honestly: no. I didn't have to do this. One possible reason for this happening could be because I had to set up the certificates again, and possibly "installed" the distribution before the development. It's just me guessing, but to answer your question: I still have them set up as Development, and chose Distribution when archiving the build for upload to App Store. Nov 23, 2018 at 8:45
  • This fixed it for me. I was only getting the issue when trying to Profile the app, it was working fine it I just ran it normally. I had a developer account for debug and a distribution one for release. This honestly seems like an XCode/Profiling bug to me.
    – James
    Mar 29, 2019 at 10:03
  • 1
    Got it working but needed one more step. Since I was dealing with testing on a tethered iPhone, I didn't worry about going into the App Store and setting up my "iOS Distribution" certificate. Since I was doing development, I assumed only would need an "iOS Development" certificate setup on the App Store. Well, it didn't work until I had both an "iOS Development" and an "iOS Distribution" certificate.
    – Stagr.Lee
    May 15, 2019 at 17:44
  • 1
    Wonderful!!!! Literally pulled my hair off and couldn't get this to work until I read this.
    – Rahi
    Apr 30, 2020 at 18:12
97

@Stephen tks this resolved for me. I just need to go --> File --> WorspaceSettings --> Build Settings(change here to "Legacy Build System")enter image description here

enter image description here

2
  • 1
    Frustrating, this is all that has worked for me too. I registered my UDID, created my profile, I have a dev cert, it's all linked to the app I'm developing, did everything you should do to be able to run direct on device, still fails every time - until I switched it to legacy, worked first time...
    – Grant
    Jun 12, 2019 at 3:02
  • This solution is likely to become more and more unstable until it is no longer available. I recommend to not attempt this
    – Ky -
    Dec 16, 2021 at 21:13
52

I have tried all the above solutions.

However, in my case, after hours of headache it was because of the Test Project does not have a valid account for provisioning the signing. After I selected a team to provision in the Test Project with automatic managed signing. This problem went away.

3
  • How did you do that?
    – red-devil
    Nov 19, 2018 at 5:46
  • 2
    @red-devil So, you will have to update the signing management in all your target projects.
    – Chen
    Dec 5, 2018 at 21:42
  • Thanks man, all the above answers didn't solve my problem. Your answer did the magic.
    – HungrySoul
    Aug 27, 2019 at 12:30
34

Use clean build folder (command + shift + K) and rebuild app can shortly fix this issue. However, the build time will increase since you have cleaned the build folder.

7
  • 1
    This worked for me (plus deleting derived data) whereas the suggestions to use legacy mode didn't work.
    – Chris
    Nov 5, 2018 at 0:26
  • 1
    Turned out for me i had a different team for my normal vs my test target, that was causing issues that only deleting derived data could reset.
    – Chris
    Nov 6, 2018 at 9:16
  • 1
    Solely cleaning the build folder (command + shift + K) fixed the issue for me. Thank @JeromeLi !
    – Chilly
    Mar 15, 2019 at 6:36
  • 1
    I tried the accepted answer ("Legacy mode") first, and it worked for me. Then I reverted to "New Build System" and tried this ("Clean build folder") suggestion. It worked too. So on balance, for me, this is the better answer. May 14, 2019 at 20:50
  • 1
    This worked for me, thanks.(ps: only my iPhone 11 had this issue, my iPhone Xs Max doesn't have this issue, and iPhone 11 was first time to install my test project) Nov 4, 2019 at 12:49
25

In my case, here are the steps that I resolve the problems:

  1. Go to this folder: ~/Library/MobileDevice/Provisioning Profiles/
  2. Remove all the provisioning profile
  3. In Xcode 10 menu > Product > Clean Build Folder
  4. In Xcode 10 menu > Xcode > Preferences > Account > Download Manual Profiles
  5. In Xcode 10 menu > Product > Build / Archive

The reason to take the steps above is to remove the old provisioning profiles that messed up the building process.

4
  • 2
    Only this answer solved my issue. Thanks! Feb 8, 2021 at 7:26
  • Solved for me after trying several other answers. Thanks a lot for posting.
    – Chris
    Jul 21, 2022 at 10:15
  • Did not work for me. Sep 14, 2022 at 19:04
  • @RohitSingh maybe you can elaborate a bit in a new question.
    – Raptor
    Sep 15, 2022 at 1:49
18

So this won't be the case for everyone but I thought I'd post it here anyway as there doesn't seem be any answers relating to it.

In my case I was working on an app that was being developed in ReactNative, my issue was that although my signing was correct on the main app target the test target did not have any signing applied to it.
For some reason React Native requires that both your app target and your test target are signed in order to install the app on a device.
It does specify this in the official documentation on building for device however its the only instance I have ever seen where the test target is built alongside the app for anything other than testing.

In order to sign your test target, go to your project settings by opening the project navigator (⌘1) and select your project at the top.

Inside the main editor select your main app target under Targets (should have the same name as your project) and ensure the signing is correct, then select the test target (likely just under your main app target, it should be the same name with Tests appended) and make sure its signed in the same way.

Rebuild your app and it should now install successfully.

Credit for this goes to Leo Lei, his answer here saved me a lot of headache: https://stackoverflow.com/a/48657358/732844

As an aside, if anyone knows why react native requires your test target be built alongside your app target could they let me know? The only reason I can think of is to streamline the interface so react can build a single app and do both running and testing without needing to rebuild but i'm just guessing with that one.

4
  • 3
    This fixed it for me where nothing else did. Thank you for posting. Jun 7, 2019 at 12:06
  • 3
    Many thanks to pointing this out. I renamed the project and changed the teams. Test target had an old team name. I have been struggling for hours now. Many thanks again
    – Alok C
    Sep 24, 2019 at 8:51
  • After hours of headache, this fixed it for me. Thanks a lot!
    – Johnson
    Apr 12, 2020 at 13:34
  • In my case I was also using react native but only needed to set the code signing to automatic for both the target and test target for it to run on device. This ensure the device connected had its on certificate and profiles generated
    – cherucole
    Jan 24, 2021 at 7:10
6

For our team, nothing helped. We have spend a couple of days and tried out every step that was mentioned here above in answers and comments. We tried with XCode 10 and even XCode 9.2 on an App, that is on the App store since many years.

The issue began after upgrading to MacOS Mojave. Unfortunately, going back to HighSierra didn't help then.

At least we was able again to ship into App store after we've created new certificate and provisioning profile. But we still are not able any more to test our App in release mode on real device, which is necessary to test InApp-purchases.

In short: Archiving and submission works well, running on real device not!

Several developers, several devices, macbooks, XCode versions....

At the end we had to change the AppID for being able again to test on real device.

Therefor we run two different projects now: one for shipping to TestFlight/AppStore with the real AppID and one for development purposes with another AppID.

Although this only happens on ONE particular App of our company and not all the others, we expect to run into similar issues in the future as things get more worse with Apple's development tools...

6

I had follow all above steps but it's not work form me finally. I was created duplicate Target and it's working fine. I have no idea what's wrong maybe cache memory issue

enter image description here

1
6

Today I had the same error while installing an app to my device. The problem occurred after I updated to the new xCode 11.4.

What I did to fix the issue:

  • Unpaired device (Xcode > Window > Devices And Simulators > Left click device to unpair device.
  • Restart iPhone
  • Clean Build Folder (Xcode > Product > Clean Build Folder)
  • Clean Derived Data (in ../library/Developer/Xcode/DerivedData)
  • Clean Build Folder again (Xcode > Product > Clean Build Folder)
  • Build app on device.
1
  • 1
    On my case, I fixed the issue using these steps without unpairing device. May 20, 2020 at 5:48
5

I had this issue occurring in Xcode 10.3 after I switched over to my XCTest unit test target then back to the project run time target.

Turns out I had a different Teams selected in my provisioning profile for each target.

To fix it :

  • Clean Build Folder

  • Make sure all may targets are using the same Team. See Profile Signing under the general tab.

  • If not using same Team for all targets, clean before switching to a build target with

    different team selected.

5

Make sure the provisionning profile comes from the same team in both your target and your targetTests.

1
  • 1
    Thank you! It was the issue I had when working with React Native
    – Yannickv
    Dec 18, 2019 at 10:07
5

In my case, Device date-time was set to a future date. Changing the date setting to "automatic" fixed the issue.

3

I was struggling with the same issue and the solution in my case was to log in to the developer account(s). After updating to Xcode 10 all accounts were logged out.

Use the menu "Xcode -> Preferences ... -> Accounts" and make sure all accounts you use are logged in so the provisioning profiles are accessible.

3

You need to manually install the development provisioning profile on the device.

In Xcode:

  • Go to Window > Devices and Simulators: a new window appears.
  • Find your connected device on the left pane. Right-click on it and select Show Provisioning Profiles...: a new window appears.
  • Manually add your development provisioning profile.

Re-build the app on device.

2

Finally, I figured out what's going on... almost take me 2 hours

My case is, my phone's date is not correct. I forgot I changed my phone's date. I guess that makes all of my provisioning profiles expired...

So if you've tried all of those answers but nothing works. Go to the SETTINGS, check your phone's date.

0
1

Did you maybe change your developing device? It happened to me when I bought a new iPhone and gave it the same name with my previous device. A clean build however fixed the issue.

1

You just need to change your Team. In my case that worked

1

I did try all the answers above and had no luck. After that I restart my iPhone and problem seems gone. I know it is so stupid but it worked. Answers above most probably solves the problem but if not try to restart your iOS device.

1
  • Struggling with certificates finished by simply restarting iPhone
    – Dren
    Mar 13 at 13:04
1

I had the case where my app would deploy to my iPhone but not my watch. Deploying to the watch would give the "A valid provisioning profile for this executable was not found." error. This is with XCode Version 11.2.1 and using the free developer account.

Here is what I did to get it deployed to my watch:

1) I deleted my provisioning profile in XCode. I did this by going to Window -> Devices And Simulators. Then right Click on the iPhone name and choose "Show Provisioning Profiles". From there I could delete the file

2) In The Devices and Simulators screen I also deleted my app from the "Installed Apps" section.

3) Did a "clean build folder" (Product -> Clean Build Folder)

4) In the "Build Settings" -> "Signing section" I made sure each target (iPhone, Tests and Watch) had the same settings (development team, code signing style, provisioning profile was set to automatic etc).

build settings details

5) Ensured the ~/Library/MobileDevice/Provisioning Profiles directory was empty.

6) Unplugged phone from computer

7) Rebooted computer, phone and watch

8) Plugged phone back into computer, and went through the "trust this machine" prompts on phone and watch.

9) Ran app. It worked!

1
  • Had the same issue with my apple watch, and this helped me. I also did unpair and pair again my apple watch somewhere in the process. Thanks!
    – Radu Vlad
    Dec 14, 2019 at 12:16
1

I did the following :

  1. Disconnected the device where the app was not getting installed
  2. Connected a different device < It installed on this second device
  3. After some time connected the first device and it worked!

This is very weird but it worked for me, might work for others and save the frustration.

1

Be aware that accepted answer prevents build to be uploaded to App Store Connect.

1

Open Keychain Access on your Mac and delete the old expired Apple Development certificates. This solved the issue for me.

1

Check if you're using an Ad Hoc Distribution provisioning profile and not an App Store Distribution provisioning profile instead, I was getting this error because of that.

1

It takes a long time, and we did all the above solutions and they didn't work at all so our team decided to remove Pod files and run pod install again. finally, our OTA uploaded ipa installed on the user's device. best Solution

  1. clean project menu > Product > Clean Build Folder and /Users/{you user name}/Library/Developer/Xcode/DerivedData

  2. go to your project directory and remove Podfile.lock ,Pods folder,pod_***.framework

  3. run pod install again

1

I was using Xcode 13.3 swift 5, in my case only profiling on device/iPhone was throwing this error and I did the following:

1- go to project edit scheme

enter image description here

2- then go to profile tab info tab and then select building configuration debug

enter image description here

3- run profiling command ⌘+i

0
0

In my case, where nothing else helped, i did the following:

  1. change the AppID to a new one
  2. XCode automatically generated new provisioning profiles
  3. run the app on real device -> now it has worked
  4. change back the AppID to the original id
  5. works

Before this i have tried out every step that was mentioned here. But only this helped.

0

For me even thou the distribution certificate and provisioning profile was available for Xcode, selecting Automatic manage signing during the distribute process made it fail. I did the following. As mentioned before I created a new distribution certificate and provisioning profile and then during distribute process manually selected the certificate and provisioning profile and Voilaaaa. Also made sure I am on the latest version 10.1.

0

It seems that Apple fixed this bug in Xcode 10.2 beta 2 Release.

https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_beta_2_release_notes

Signing and Distribution Resolved Issues

When you’re building an archive of a macOS app and using a Developer ID signing certificate, Xcode includes a secure timestamp in the archive’s signature. As a result, you can now submit an archived app to Apple’s notary service with xcrun altool without first needing to re-sign it with a timestamp. (44952627)

When you’re building an archive of a macOS app, Xcode no longer injects the com.apple.security.get-task-allow entitlement into the app’s signature. As a result, you can now submit an archived app to Apple’s notary service using xcrun altool without first needing to strip this entitlement. (44952574)

Fixed an issue that caused the distribution workflow to report inaccurate or missing information about the signing certificate, provisioning profile, and entitlements used when exporting or uploading an app. (45761196)

Fixed an issue where thinned .ipa files weren’t being signed when exported from the Organizer. (45761101)

Xcode 10.2 beta 2 Release can be downloaded here: https://developer.apple.com/download/

1
  • 3
    that's great. but if you'll be building apps for the appstore, it will not let you upload the ipa if you're using beta software
    – Yasha
    Feb 27, 2019 at 16:30
0

After I tired most of solution, I found what its make it work without any issue for me, Its resolved by go to developer.apple.com then account then Certificates, identifiers & profiles and I click on All link under Devices and then add a new device.

then you need to set device name, and uuid, and after save it. Go to xcode and clean cache, build, and all its work fine.

Note 1: make sure your team is set truth.

Note 2: You can get uuid by connect device to your mac device, and click on iTunes, and press on security label, you will see UUID.

Which This Answer its helpful too.

Not the answer you're looking for? Browse other questions tagged or ask your own question.