ChatGPT解决这个技术问题 Extra ChatGPT

Xcode 10: A valid provisioning profile for this executable was not found

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

https://i.stack.imgur.com/vKsC8.png

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.

Have you added the developer account in Xcode preferences?
@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?
Yes you can submit the builds from xcode 9 and its version until March 2019 developer.apple.com/ios/submit
Also I tried with Xcode 10 as well and I am not facing such issues of missing provisioning-profile.
Did you change your iPhone date past the expiry data of your certificate? I faced this issue due to this reason.

S
Stephen

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.


But what does this mean? What effect does it have and how do we know we can change the settings again?
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
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.
Not work for me :((.My Xcode Version is 10.1. My iPhone OS version is 12.1
I am using xcframework which absolutely needs new build system, so I can't change to legacy build system!
Z
Zoe stands with Ukraine

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

https://i.stack.imgur.com/it4Aa.png


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?
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.
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.
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.
Wonderful!!!! Literally pulled my hair off and couldn't get this to work until I read this.
V
Vinícius Todesco

https://i.stack.imgur.com/GKnYK.png

https://i.stack.imgur.com/edQ5L.png


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...
This solution is likely to become more and more unstable until it is no longer available. I recommend to not attempt this
C
Chen

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.


How did you do that?
@red-devil So, you will have to update the signing management in all your target projects.
Thanks man, all the above answers didn't solve my problem. Your answer did the magic.
J
Jerome Li

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.


This worked for me (plus deleting derived data) whereas the suggestions to use legacy mode didn't work.
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.
Solely cleaning the build folder (command + shift + K) fixed the issue for me. Thank @JeromeLi !
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.
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)
S
Stewart Thomson

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.


This fixed it for me where nothing else did. Thank you for posting.
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
After hours of headache, this fixed it for me. Thanks a lot!
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
R
Raptor

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

Go to this folder: ~/Library/MobileDevice/Provisioning Profiles/ Remove all the provisioning profile In Xcode 10 menu > Product > Clean Build Folder In Xcode 10 menu > Xcode > Preferences > Account > Download Manual Profiles 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.


Only this answer solved my issue. Thanks!
Solved for me after trying several other answers. Thanks a lot for posting.
d
delete

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


A
Arjun Patel

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

https://i.stack.imgur.com/0PtOT.png


C
Community

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.


a
ancyrweb

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


Thank you! It was the issue I had when working with React Native
w
waheeda

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


M
Milander

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.


On my case, I fixed the issue using these steps without unpairing device.
A
Alex Alexiev

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.


b
boog

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.


J
Jonathan Maim

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.


A
Apostolos Apostolidis

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.


S
SwiftNewling

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


M
Monica Granbois

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

https://i.stack.imgur.com/l4OIh.png

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!


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!
O
Omkar Jadhav

I did the following :

Disconnected the device where the app was not getting installed Connected a different device < It installed on this second device 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.


P
Pashynia

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


V
Vladimir Grigorov

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


R
Ricardo Barroso

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.


N
Nimantha

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

clean project menu > Product > Clean Build Folder and /Users/{you user name}/Library/Developer/Xcode/DerivedData go to your project directory and remove Podfile.lock ,Pods folder,pod_***.framework run pod install again


D
Dharman

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

https://i.stack.imgur.com/IpgCz.png

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

https://i.stack.imgur.com/UzreH.jpg

3- run profiling command ⌘+i


i
itinance

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

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

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


P
Pushparaj Samant

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.


A
Artem Shevtsov

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/


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
A
Anees Hikmat Abu Hmiad

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.


e
emin deniz

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.