简体   繁体   中英

Xcode 11 live preview on device fails, but app runs correctly

I want to preview my views on a real device, but Xcode fails when I click the button:

无法在此文件中预览 - 发生意外错误

Clicking the "Diagnostics" button shows the following error:

UVIntegration.ConcreteHardwareDevice.(unknown context at $13f0b5314).(unknown context at $13f0b531c).InstallError.failedToInstall(Error Domain=com.apple.dtdevicekit Code=-402620394 "Unable to install "AppName"" UserInfo={NSLocalizedDescription=Unable to install "AppName", NSUnderlyingError=0x7fe0360a1c50 {Error Domain=com.apple.dtdevicekit Code=-402620394 "The executable was signed with invalid entitlements." UserInfo={NSLocalizedFailureReason=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)., com.apple.dtdevicekit.stacktrace=(

----------------------------------------

GenericHumanReadableError: unexpected error occurred

failedToInstall(Error Domain=com.apple.dtdevicekit Code=-402620394 "Unable to install "AppName"" UserInfo={NSLocalizedDescription=Unable to install "AppName", NSUnderlyingError=0x7fe0360a1c50 {Error Domain=com.apple.dtdevicekit Code=-402620394 "The executable was signed with invalid entitlements." UserInfo={NSLocalizedFailureReason=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)., com.apple.dtdevicekit.stacktrace=(
    0   DTDeviceKitBase                     0x00000001217c66e7 DTDKCreateNSError + 109
    1   DTDeviceKitBase                     0x00000001217c6de9 DTDK_AMDErrorToNSError + 792
    2   DTDeviceKitBase                     0x000000012180656a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
    3   DVTFoundation                       0x0000000106e95c12 DVTInvokeWithStrongOwnership + 73
    4   DTDeviceKitBase                     0x0000000121806301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
    5   IDEiOSSupportCore                   0x000000012168ea25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
    6   DVTFoundation                       0x0000000106fc6e7a __DVT_CALLING_CLIENT_BLOCK__ + 7
    7   DVTFoundation                       0x0000000106fc8552 __DVTDispatchAsync_block_invoke + 809
    8   libdispatch.dylib                   0x00007fff72809583 _dispatch_call_block_and_release + 12
    9   libdispatch.dylib                   0x00007fff7280a50e _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x00007fff7280face _dispatch_lane_serial_drain + 597
    11  libdispatch.dylib                   0x00007fff72810452 _dispatch_lane_invoke + 363
    12  libdispatch.dylib                   0x00007fff72819a9e _dispatch_workloop_worker_thread + 598
    13  libsystem_pthread.dylib             0x00007fff72a6371b _pthread_wqthread + 290
    14  libsystem_pthread.dylib             0x00007fff72a6357b start_wqthread + 15
), DVTRadarComponentKey=487927, NSLocalizedDescription=The executable was signed with invalid entitlements.}}})

The above suggests that my provisioning setup is wrong, but if I click the "run" button, the app is deployed and runs absolutely fine on my devices.

What am I doing wrong?

Following fixed for me:

Select your command line tool by going to: Preferences > location > commandLine tools [drop down] > select Xcode 11 It be selected to previous one (ie Xcode 10)

I finally got this working!

Whilst everything with the app bundle was correct (which is why the app ran on-device absolutely fine), the Tests and UITests bundles had the wrong team selected for their signing, and after I changed those I got errors saying that the bundle ID for my test bundle couldn't be registered to our team. I changed my bundle IDs and now I can preview my app on-device!

我在 Xcode 11 中遇到问题,更新到最新版本解决了我的问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM