65

I recently updated my OS to Catalina, and updated Xcode to 11.2. Since doing so, when I try to run a release version of my app on my device, I'm simply given the error:

Unable to install the app.

When I tap 'details', it provides me with the following:

App installation failed Domain: com.apple.dtdevicekit Code: -402620395 Failure Reason: A valid provisioning profile for this executable was not found.

User Info: { DVTRadarComponentKey = 487927; "com.apple.dtdevicekit.stacktrace" = ( 0 DTDeviceKitBase 0x000000011baff6e7 DTDKCreateNSError + 109 1 DTDeviceKitBase
0x000000011baffde9 DTDK_AMDErrorToNSError + 792 2 DTDeviceKitBase
0x000000011bb3f56a 90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164 3 DVTFoundation 0x000000010356f156 DVTInvokeWithStrongOwnership + 73 4 DTDeviceKitBase
0x000000011bb3f301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589 5 IDEiOSSupportCore 0x000000011b9c7a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523 6 DVTFoundation 0x00000001036a03ba __DVT_CALLING_CLIENT_BLOCK
+ 7 7 DVTFoundation 0x00000001036a1a92 __DVTDispatchAsync_block_invoke + 809 8
libdispatch.dylib 0x00007fff68220583 _dispatch_call_block_and_release + 12 9 libdispatch.dylib 0x00007fff6822150e _dispatch_client_callout + 8 10 libdispatch.dylib 0x00007fff68226ace _dispatch_lane_serial_drain + 597 11 libdispatch.dylib 0x00007fff68227452 _dispatch_lane_invoke + 363 12 libdispatch.dylib 0x00007fff68230a9e _dispatch_workloop_worker_thread + 598 13 libsystem_pthread.dylib 0x00007fff6847a71b _pthread_wqthread + 290 14 libsystem_pthread.dylib 0x00007fff6847a57b start_wqthread + 15 ); }

My provisioning profiles are 100% correct, as are my certificates. I have no idea why this is happening, and I've tried absolutely everything to get it to install/run. I've tried:

  • Double checked that 'Scheme' has release checked under the 'Run' tab
  • Confirmed that correct provisioning profile is selected
  • Removing the app from my device
  • Creating new provisioning profiles
  • Changing my bundle ID
  • Creating new certificates
  • Cleaning the build folder, restarting Xcode
  • Reinstalling Xcode
  • Deleting the Derived Data folder

NONE of the above has worked. I've been at this for 2 days now - help is appreciated. The only way I'm able to install the app file successfully to my device is if I upload it to TestFlight first (which, I can't feasibly do every time I want to test a small change).

shim
  • 9,289
  • 12
  • 69
  • 108
Brittany
  • 1,359
  • 4
  • 24
  • 63
  • Have you been able to verify this with a second device? – CodeBender Nov 01 '19 at 16:41
  • Yes, I've tried installing the app to 2 different devices, same error each time. @CodeBender – Brittany Nov 01 '19 at 16:44
  • 1
    You mentioned that you updated to 11.2 recently, is this the first time you have built with Xcode 11.x? For distribution profiles in Apple's developer site, there is a new option specific to Xcode 11 & are you using that? – CodeBender Nov 01 '19 at 16:50
  • I previously had XCode 11.1, so I updated the distribution profiles then to the newer versions (Apple Distribution & Apple Development). @CodeBender – Brittany Nov 01 '19 at 16:51
  • FWIW, I'm running into the same exact issue with 11.2, while trying to deploy a "Profile" build to my device. Running 'Debug' builds works fine. And I'm running Mojave, not Catalina. – Z S Nov 01 '19 at 20:18
  • I'm having the same issue lately when adding certain frameworks/libraries. I can't pinpoint it yet with which frameworks it's happening, but its clearly linked for me. Maybe its similar for you. – max Nov 03 '19 at 22:38
  • Are you using automatic signing or manual? – shim Nov 04 '19 at 00:35
  • Manual - but I've tried switching to automatic to see if it solves the problem and it does not. @shim – Brittany Nov 04 '19 at 00:37
  • Have you tried selecting Ad Hoc as the distribution option in Xcode instead of App Store (not as a solution, just curious if it also fails)? There is a difference between a release provisioning profile for the App Store (i.e. what is used with TestFlight) and one for Ad Hoc. – shim Nov 04 '19 at 00:37
  • 1
    Also under File > Workspace Settings under "Build System" what do you have selected? – shim Nov 04 '19 at 00:42
  • You can also check in ~/Library/MobileDevice/Provisioning Profiles and see what provisioning profiles are there. (Use spacebar preview to see summary of each profile's info.) – shim Nov 04 '19 at 00:43
  • I know this isn't really what you want to do -- but have you tried re-downloaded Xcod 11.1 and using that in the meantime? (I'm doing that now.) – drewster Nov 05 '19 at 05:41
  • Update: So when I switch to an Ad Hoc Distribution Profile, the app now installs to the device. That said, upon launch, it crashes without any explanation / console log. Before updating to XCode 11, this never happened. @shim – Brittany Nov 06 '19 at 06:00
  • What version of iOS is your device running? – shim Nov 06 '19 at 15:51
  • @shim Currently have 13.2 running. – Brittany Nov 06 '19 at 16:29
  • And the app does not crash when running with Xcode attached? / did you check the crash logs on the device? – shim Nov 06 '19 at 17:56
  • I can't believe it - hilariously I was never able to unpack 11.2.1 via the xip file, but they released it to the App Store and I was able to update. FINALLY solved the issue, in conjunction with using an Ad Hoc Provisioning Profile instead of just a regular Distribution Profile. Good work all. Thank you! @shim – Brittany Nov 17 '19 at 04:05
  • 1
    It's driving me nuts!!! I still have this issue and none of the solutions here solved it. Are there any other ideas? – Georg Dec 03 '19 at 13:51
  • I face it 100 times per day, this is so crazy – えるまる Jan 24 '20 at 06:26

31 Answers31

34

Go to File -> Workspace Settings, and make sure your build system is set to Legacy Build System.

I ran into the same issue on Catalina and Xcode 11.2 and this solved it for me.

As of Xcode 11 Apple is starting to enforce some of the build criteria that was previously only required for AppStore builds on .ipa extraction, and device builds.

So far I have encountered:

  • Requiring the above legacy build system setting for device deployments for older projects or projects that use older frameworks
  • Removing unused architectures to extract an ipa from an archive
shim
  • 9,289
  • 12
  • 69
  • 108
Lean van Heerden
  • 882
  • 9
  • 20
  • Probably the same issue -- seeing a slightly different error, but no solutions here solved it. The executable was signed with invalid entitlements. Domain: com.apple.dtdevicekit Code: -402620394 Failure Reason: The entitlements specified in your application’s Code Signing Entitlements file are invalid, not permitted, or do not match those specified in your provisioning profile. (0xE8008016). – drewster Nov 05 '19 at 05:18
  • 2
    @drewster I had the same error as well, and it was related to unused architectures in the build. Sometimes frameworks will specify x86 architectures over and above the arm architectures. Running the [script specified in this SO article](https://stackoverflow.com/questions/30547283/submit-to-app-store-issues-unsupported-architecture-x86/41416964#41416964) solved the issue for me. – Lean van Heerden Nov 05 '19 at 19:38
  • 8
    Changing to Legacy Build System did not work for me unfortunately :/ – Brittany Nov 08 '19 at 06:00
  • 1
    Spent hours on this. I added a project in the workspace that generated a framework I created as a target. I then embedded/linked the main project in the workspace to that framework project. Using the new build system in 11.2.1 GM, exporting IN HOUSE would then show "Could not install..." on a supervised device. Reading this post, I then switched to Legacy Build System. What that did is show ERRORS!!! telling me lipo could not strip the wrong architecture when archiving. So that pointed in the right direction and I then fixed the framework that was not getting built properly. THANK YOU LEGACY! – zumzum Nov 09 '19 at 06:35
  • In my case switch to legacy did not solved that. It was due to a change in the provisioning profile. I ended up delete the app from device and then the installation was successful. – Konstantinos Jan 11 '20 at 19:26
  • Thank You!! In my case I needed to do what You and Vittal Pai told. – Breno Medeiros de Oliveira Jul 01 '20 at 20:26
  • 1
    Legacy Build System is deprecated. This is what it tells in my Xcode editor. – Markus Nov 28 '20 at 21:03
  • 1
    @Markus yes it has been deprecated for a few years now, but still supported for now. It does mean that XCode could stop support at any future date. It is there to give developers an opportunity to update their projects before support for the legacy build system is dropped. – Lean van Heerden Nov 30 '20 at 01:07
25

For me, it's due to Dynamic Frameworks which I have added in the application. Initially, I have selected (Embed + Don't Sign) option for the dynamic frameworks.

Changing it to (Embed & Sign) for such frameworks resolved the issue for me.

enter image description here

Vittal Pai
  • 3,317
  • 25
  • 36
  • 1
    Just added external framework with "Embed Without Sign", had the same issue. Changed it to Embed & Sign - well done! – malex Mar 20 '20 at 21:48
  • Thank You!! It was the "Pods_MyApp.framework" created by Cocoapods that needed "Embed & Sign". In my case I needed to do what You and Shim told. – Breno Medeiros de Oliveira Jul 01 '20 at 20:22
21

Here is what works for me:

  1. Remove the app and profile from device
  2. Reinstall them again.
Lew Winczynski
  • 1,190
  • 1
  • 11
  • 20
13

Use Automatically manage signing

Solve this issue.

checked auto signing

acoder
  • 249
  • 5
  • 14
8

I manage to fix this issue when first I clean:

cmd + k
shift + cmd + k

and then I delete all the content of Deriving Data the path of the folder should be like this

/Users/youruser/Library/Developer/Xcode/DerivedData

Or you can check it in

Xcode -> Preferences -> Locations
m1sh0
  • 2,236
  • 1
  • 16
  • 21
  • This worked for me! I just did the first two shortcuts (`cmd + k` and `shift + cmd + k`, then installing my app went accordingly. – user8460166 Nov 01 '21 at 00:34
7

"-402620395 Failure Reason: A valid provisioning profile for this executable was not found."

I had this issue as well and solved it:

This means that your provisioning profile is not set to development. You need to create a new provisioning profile for development, which is different than a profile set for distribution. Then, in signing and capabilities, in your app settings on xcode, choose your development profile if you want to install on your device. Don't worry about distributing with your dev profile, you must choose which profile you want to use when pushing to app store (its set to none and you need to switch it).

Another solution would be choosing automatically manage signing in settings, but that has defaults set when pushing to app store which you might not want.

6

Xcode error

Unable to install the app.

Try to clean Provisioning Profiles[About]

Xcode -> Window -> Devices and Simulators 
-> Right click on your device -> Show Provisioning Profiles...
-> Select Provisioning Profile -> - Remove selected profiles
yoAlex5
  • 29,217
  • 8
  • 193
  • 205
4

Delete derivedData folder

rm -rf ~/Library/Developer/Xcode/DerivedData
Heartless Vayne
  • 904
  • 1
  • 8
  • 18
2

This issue is only related to CODE SIGNING

But, the key point to note here is, if you are using XCode 11.x version. Not only the code signing in your project, but we should check the code signing in Thirdparty SDKs or dependencies that we add to our project.

Steps to verify the Code Signing of 3rd party SDks:

  1. Download the source code of framework you need
  2. Open the .xcproj file from the source code using XCode 11.x
  3. Go to Targets -> Signing & Capabilities -> Select all tab -> Bundle Identifier If you see any unevenness in the identifier like, identifier with 4 seperators (Eg: com.company.mac.app)

    Change it to com.* and enter.

  4. Make sure your XCODE COMMAND LINE TOOLS is set with XCode 11.x

  5. Now, use below command to rebuild the SDK, with the changes done in above step-3

      carthage build --no-skip-current --cache-builds --platform iOS
    
  6. Now copy the framework generated from, carthage folder of source code, and replace the existing SDK in your project.

Repeat the same for process for all the 3rd party SDKs, in your project.

NOTE: Make sure you marked all the 3rd party SDKs as Embed & Sign in

Targets => General => Frameworks, Libraries, and Embedded Content
Teja Kumar Bethina
  • 3,486
  • 26
  • 34
2

For me, it was that the watch i was trying to use didn't unlock so i had to lock and unlock my watch again and then it was working fine.

Petter Braka
  • 311
  • 1
  • 11
2

This is very strange but for me pod deintegrate and then pod install works.

Try out this solution if none of the above works for you

Crazy Developer
  • 3,464
  • 3
  • 28
  • 62
1

I had the same problem until I found this solution. I had to clear out all of my old certificates and provisioning profiles and then create new certificates with "Apple Development" and "Apple Distribution," instead of the "iOS..." option.

user1791914
  • 616
  • 9
  • 23
1

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

enter image description here

enter image description here

iGW
  • 633
  • 5
  • 14
  • This doesn't fix the issue, it will cause the bundle to get the development provisioning profile instead of the distribution one which is what you might want. – Bruno Muniz Sep 10 '21 at 21:15
1

In my case the problem was occurred by empty framework references in pbxproj. After removing them the problem was fixed.

enter image description here

Sahey
  • 264
  • 3
  • 9
1

This is a codesign problem.

You can check iOS device logs to see which framework go wrong. filter 'installd' process. you can clearly say which framework codesign is wrong. so just find it out and fix it!

0x16fa53000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 77: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.dABVKh/extracted/Your.app/Frameworks/xxx.framework : 0xe8008001 (An unknown error has occurred.)
0x16fa53000 -[MIInstaller performInstallationWithError:]: Verification stage failed
frank
  • 2,327
  • 1
  • 18
  • 20
1

Most probably you are manually code signing your app and use a manual provisioning profile.

The problem occurs when you try to deploy your app to your physical device with distribution provisioning profile.

The solution is to create 2 different provisioning profiles; one for the development and the other is for distribution.

You can manage your provisioning profiles at https://developer.apple.com/account/resources/profiles/list

After that, set your provisioning profiles as the image below:

enter image description here


Note:

if you don't see your settings separated into two, you can use the tab above and set your profiles for each type of provisioning profiles (Debug and Release)

enter image description here

Eray Alparslan
  • 806
  • 7
  • 12
1

Here is what works for me:

  1. Remove the app and profile from device
  2. Reinstall app again.

In Some cases:

  1. restart xcode
  2. clean build
  3. Reinstall the app again
Hanzala Raza
  • 149
  • 1
  • 16
0

I have the same issue and the problem was that I were using unpaid account and the total number of free development profiles was reached ,so you have to use paid account

detailes :

Failure Reason: The maximum number of apps for free development profiles has been reached

abed
  • 71
  • 7
0

I got this error when running a project that had a library under Embed Frameworks which had Code Sign on Copy unchecked. Check-marking this resolved this issue for me.

Stunner
  • 12,025
  • 12
  • 86
  • 145
0

Struggled with this for a long time. What fixed it for me was deleting all the cache data generated by Xcode like Device Support, Archives, Derived data, etc...

JP Aquino
  • 3,946
  • 1
  • 23
  • 25
0

I got this issue resolved after a whole day of mental agony.

For WebDriverAgentRunner package, WebDriverAgentRunner --> Build Settings --> Product Bundle Identifier --> Provide a custom bundle identifier name

N.B: Copy the bundle identifier name you just provided.

Move to WebDriverAgentRunner --> Info --> Bundle Identifier --> Provide here the bundle identifier name you just copied

Follow the same step for the APP package you are trying to push.

Clean build folder and start building and APP should get pushed without an issue. Tested on Xcode 11.7

0

In Xcode 12, I got an error window saying: Unable to install "AppName".
I clicked Details and found that There was no space on my iPhone.

stackich
  • 3,607
  • 3
  • 17
  • 41
0

In My case just remove the existing build in my phone then run again its working perfectly.

Muhammad Usman
  • 141
  • 1
  • 4
0

I have received this error message after I updated my MacOS (specific to Big Sur) and Xcode (to version 12.5). For me what have solved the problem is just deleting the app from the device and re-install

CloudBalancing
  • 1,461
  • 2
  • 11
  • 22
0

Yes, Faced this issue several times for several xcode and cocoapods versions. This issues happen when each pod frameworks can't find specific info.plist file in project. Of course I don't know why after pod install, each pod frameworks can't find info.plist. In my case I've linked manually to the project main info.plist for each pod frameworks. :) Such as below. enter image description here

After this, I could successfully install app to device or simulator. Hope this help everyone.

DarkHorse
  • 339
  • 4
  • 16
0

Use automatic signing on 'signing and capabilities'

Bruno Muniz
  • 316
  • 3
  • 17
0

My case's

Final solution:

  • upgrade from XCode 13.0 to XCode 13.1

Root cause

XCode's bug, not generated proper Provisioning Profile for iOS app/project

cause later:

  • can not install app: Unable to install
  • can not debug app: failed to get the task for process

both internal specific error reason is:

A valid provisioning profile for this executable was not found

crifan
  • 12,947
  • 1
  • 71
  • 56
0

For me none the answers worked.

The solution was for me to got to your project, then select your project under "TARGETS". Go to "Build Phases" -> "[CP] Embeb Pods Frameworks" and unselect "For Install Builds Only".

Yes, this is disabled in default, but I turned it on once for a problem I had.

MuSoundiX
  • 88
  • 8
0

I had to go to Build Settings and have Excluded Architectures look exactly like this: enter image description here

Alexander Vitanov
  • 4,074
  • 2
  • 19
  • 22
0

Do not forget to read the error reason before deleting DerivedData or messing with code signing. I didn't pay attention that in my case error was caused due to:

Error details

Cleaning the device helped :)

-1

Xcode 11.2 is deprecated by Apple on November 5, 2019

Even if you can install it on your device, you can't pass AppStore: See here for logs

Download the latest valid to AppStore version xip file.

Preview

Xcode 11.2 had some issues and crashes older iOS devices and does not install on newer iOS devices. So for now you can:

So The Solution is:

  1. Update macOS to 10.15.1
  2. Install Xcode 11.2.1 GM seed
  3. Build and install the app on the updated device (13.2.2 is out now)
Community
  • 1
  • 1
Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
  • Downloading Xcode 11.2.1 GM seed now... I'll let you guys know if it resolves the issue. Glad it's not just me - starting to feel like I'm taking crazy pills using Xcode 11.2. – Brittany Nov 06 '19 at 16:27
  • 2
    Based on the linked SO post, the crash is relevant to pre-iOS 13 devices that have a `UITextView`. There's nothing in there about installation issues "on newer iOS devices" – shim Nov 06 '19 at 18:27
  • That post contains many links since Apple produce chaos. @shim but now apple accepts the issue and deprecates Xcode 11.2 completely and removed it from the AppStore. – Mojtaba Hosseini Nov 07 '19 at 19:06
  • 3
    This answer is not relevant to the problem, I tested the app deployment using Xcode 11.2.1 and the issue still persisted. The only way I could get the app deployed to a device with Xcode 11.2.1 was to set "File -> Workspace Settings-> Build System" to "Legacy Build System" – Lean van Heerden Nov 08 '19 at 01:24
  • @MojtabaHosseini I haven't even been able to unarchive the folder. In the middle of it now - oddly it seems to stop every time it's almost finished unpacking. Anyone know how large this folder is? And should it be taking forever to unpack? – Brittany Nov 08 '19 at 19:16
  • Unfortunately sometimes it gets long time, even it's Calculating Size takes forever so I can't tell you how large is it. @Brittany – Mojtaba Hosseini Nov 08 '19 at 19:19