Search code examples
xcodemacos-catalinamac-catalyst

Xcode 11.2 and 11.2.1 GM SEED -- Cannot install to device


I've got an Xcode Catalyst / SwiftUI project that I had been developing under Xcode 11.1. Under 11.1, everything works correctly.

When I upgraded to Xcode 11.2, I started getting the error:

Unable to Install "App_Name"

(where "App_Name" is the name of my actual app.)

If I click Details, it shows the following:

Details

Unable to install "APP_Name"
Domain: com.apple.dtdevicekit
Code: -402620394
--
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).
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x000000011f0e46e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x000000011f0e4de9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x000000011f12456a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x0000000105db9156 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x000000011f124301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x000000011efaca25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x0000000105eea3ba __DVT_CALLING_CLIENT_BLOCK__ + 7
7 DVTFoundation 0x0000000105eeba92 __DVTDispatchAsync_block_invoke + 809
8 libdispatch.dylib 0x00007fff6431a583 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff6431b50e _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff64320ace _dispatch_lane_serial_drain + 597
11 libdispatch.dylib 0x00007fff64321452 _dispatch_lane_invoke + 363
12 libdispatch.dylib 0x00007fff6432aa9e _dispatch_workloop_worker_thread + 598
13 libsystem_pthread.dylib 0x00007fff6457471b _pthread_wqthread + 290
14 libsystem_pthread.dylib 0x00007fff6457457b start_wqthread + 15
);
}

The result is the same under 11.2.1 GM SEED (19B88).

If I go back to 11.1, it works normally and runs on device.

If I try different iOS devices, it still fails.

If I create a new Catalyst / SwiftUI project from the Xcode template, it runs on device without issue.

Note that I also did look at this posting: Xcode 11.2 - Unable to install App file to device?. I posted this as a separate question, because the actual Failure Reason given, is quite different, and thus, they are most likely two unrelated issues.

Build device: 2018 MacBook Pro 15", running macOS Catalina Version 10.15.1 (19B88)

Xcode 11.2 and 11.2.1 GM SEED (11B53)

iOS 13.2.2 on iPhone 11 Pro Max (also tested on iPhone XS Max and iPhone X with other earlier versions of iOS 13.)

I've tried switching between "Automatically manage signing" and selecting manually, but nothing I've changed has helped.

Obviously Xcode 11.2 is doing something different with respect to code-signing that's breaking this, but I'm not sure what.

Tried deleting DerivedData too, of course.

Thank you!


Solution

  • I found the solution to this based on some help from Ted Jucevic @ Apple (thanks Ted!).

    The problem was the entitlements file was corrupted.

    Here it is as xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key></key>
        <array>
            <string></string>
        </array>
        <key>com.apple.security.files.user-selected.read-write</key>
        <true/>
        <key>com.apple.security.network.server</key>
        <true/>
        <key>com.apple.security.personal-information.location</key>
        <true/>
        <key>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.network.client</key>
        <true/>
    </dict>
    </plist>
    

    Here's what it looked like in Xcode:

    App_Name.entitlements

    As you can see, right at the top, there is an empty item:

    <key></key>
    <array>
        <string></string>
    </array>
    

    This was probably supposed to be a keychain-access-groups entitlement, such as is described here.

    Anyway, deleting that bogus entry above resolved it, and I am now able to build-and-run on device again. I have no idea how it initially became corrupted, but I think it had something to do with Xcode 11.2.

    Hopefully this info helps someone else too!