Xcode 11 install to device fails, code -402620415

After the upgrade to Xcode 11, an existing app that once was debuggable on device can no longer be installed and debugged on device. It is failing with an unknown error. Same failure occurs on Xcode 11.2.1 and Xcode 11.3 beta. App debugging on SImulator works fine.


This is not reporting a codesign or provisioning failure (I've seen those in the past). I'm hoping someone can help narrow down the culprits.


Details


Unable to install "NameOfMyApp"

Domain: com.apple.dtdevicekit

Code: -402620415

--

App installation failed

Domain: com.apple.dtdevicekit

Code: -402620415

Failure Reason: An unknown error has occurred.

User Info: {

DVTRadarComponentKey = 487927;

"com.apple.dtdevicekit.stacktrace" = (

0 DTDeviceKitBase 0x000000012692a6e7 DTDKCreateNSError + 109

1 DTDeviceKitBase 0x000000012692ade9 DTDK_AMDErrorToNSError + 792

2 DTDeviceKitBase 0x000000012696a56a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164

3 DVTFoundation 0x000000010b4ea156 DVTInvokeWithStrongOwnership + 73

4 DTDeviceKitBase 0x000000012696a301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589

5 IDEiOSSupportCore 0x00000001267f2a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523

6 DVTFoundation 0x000000010b61b3ba __DVT_CALLING_CLIENT_BLOCK__ + 7

7 DVTFoundation 0x000000010b61ca92 __DVTDispatchAsync_block_invoke + 809

8 libdispatch.dylib 0x00007fff590635f8 _dispatch_call_block_and_release + 12

9 libdispatch.dylib 0x00007fff5906463d _dispatch_client_callout + 8

10 libdispatch.dylib 0x00007fff5906a8e0 _dispatch_lane_serial_drain + 602

11 libdispatch.dylib 0x00007fff5906b396 _dispatch_lane_invoke + 385

12 libdispatch.dylib 0x00007fff590736ed _dispatch_workloop_worker_thread + 598

13 libsystem_pthread.dylib 0x00007fff592a4611 _pthread_wqthread + 421

14 libsystem_pthread.dylib 0x00007fff592a43fd start_wqthread + 13

);

}

--

@jsnee I'm facing the same problem, please have a look at FB10962213

I was able to identify the issue in my case. We have notification extension in the app and update bundle version after compile for builded extension .appex file and for the main .app file in the Info.plist. It looks like Xcode do not resign .appex file for some reason and so the app installation on a device fails.

From Xcode detailed info:

An unknown error has occurred.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620415
User Info: {
    DVTRadarComponentKey = 280331;
    MobileDeviceErrorCode = "(0xE8008001)";
    "com.apple.dtdevicekit.stacktrace" = (
    0   DTDeviceKitBase                     0x000000011804a9d1 DTDKCreateNSErrorFromAMDErrorCode + 220
    1   DTDeviceKitBase                     0x0000000118086ce7 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
    2   DVTFoundation                       0x000000010a8d47d6 DVTInvokeWithStrongOwnership + 71
    3   DTDeviceKitBase                     0x0000000118086a1d -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1422
    4   IDEiOSSupportCore                   0x0000000117f63668 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.301 + 3414
    5   DVTFoundation                       0x000000010aa063d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
    6   DVTFoundation                       0x000000010aa074bc __DVTDispatchAsync_block_invoke + 372
    7   libdispatch.dylib                   0x00007ff80ff360cc _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x00007ff80ff37317 _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x00007ff80ff3d317 _dispatch_lane_serial_drain + 672
    10  libdispatch.dylib                   0x00007ff80ff3ddfd _dispatch_lane_invoke + 366
    11  libdispatch.dylib                   0x00007ff80ff47eee _dispatch_workloop_worker_thread + 753
    12  libsystem_pthread.dylib             0x00007ff8100eafd0 _pthread_wqthread + 326
    13  libsystem_pthread.dylib             0x00007ff8100e9f57 start_wqthread + 15
);
}

From device console:

default	23:12:27.654813+0300	installd	0x16b2cf000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 75: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.VTtCcC/extracted/***.app/PlugIns/***.appex : 0xe8008001 (An unknown error has occurred.)

As a workaround I manually added CodeSignOnCopy attribute to the application extension copy phase in the main app Build Phases in the project.pbxproj file since there were no checkmark for that in the Xcode:

139E0B1323ABAE7F00B66F5B /* Notification Content App Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 13D558D023AB9A2D00B95B48 /* Notification Content App Extension.appex */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };

@Anton Turvo, thank you very much for your comment! I can see the same error in Console:

Trust evaluate failure: [leaf IssuerCommonName LeafMarkerOid SubjectCommonName]
MacOS error: -67030
unrecognized status -67030 from codesigning library
0x16b7ab000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 75: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.97uVqY/extracted/VisionBoard.app/PlugIns/IntentsExtension.appex : 0xe8008001 (An unknown error has occurred.)
0x16b7ab000 -[MIInstaller performInstallationWithError:]: Verification stage failed

The solution you proposed to modify the contents of project.pbxprojand adding CodeSignOnCopy didn't work for me. I'm still facing the above error.

However, I have found a workaround by enabling Copy only when installing in the main target of the app in the Embed App Extensions (in Build phases section). So, the extensions are not copied to the iOS device and the error is resolved as well.

My case:

Remove the same APP already installed in the iPhone. Re Build and Run. It works for me.

Xcode 11 install to device fails, code -402620415
 
 
Q