iPhoneConnect:## 无法挂载开发人员磁盘映像,错误域=com.apple.dtdevicekit 代码=-402652958

iPhoneConnect: ## Unable to mount developer disk image, Error Domain=com.apple.dtdevicekit Code=-402652958

升级到 macOS High Sierra 后,我在终端 运行 xcodebuild 时收到此错误。

2017-09-26 10:11:03.990 xcodebuild[1333:141317]  iPhoneConnect: ## Unable to mount developer disk image, (Error Domain=com.apple.dtdevicekit Code=-402652958 "Development cannot be enabled while your device is locked." UserInfo={NSLocalizedDescription=Development cannot be enabled while your device is locked., com.apple.dtdevicekit.stacktrace=(
    0   DTDeviceKitBase                     0x0000000116c26a0d DTDKCreateNSError + 113
    1   DTDeviceKitBase                     0x0000000116c27251 DTDK_AMDErrorToNSError + 1135
    2   DTDeviceKitBase                     0x0000000116c681b7 -[DTDKMobileDeviceToken mountDeveloperDiskImage:withError:] + 782
    3   DTDeviceKitBase                     0x0000000116c68a6e -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 488
    4   IDEiOSSupportCore                   0x0000000116b4c495 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 133
    5   DVTFoundation                       0x000000010ada60eb __DVTDispatchGroupAsync_block_invoke + 806
    6   libdispatch.dylib                   0x00007fff54d447a2 _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x00007fff54d3cf64 _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x00007fff54d50110 _dispatch_continuation_pop + 599
    9   libdispatch.dylib                   0x00007fff54d478e0 _dispatch_async_redirect_invoke + 703
    10  libdispatch.dylib                   0x00007fff54d3eb56 _dispatch_root_queue_drain + 515
    11  libdispatch.dylib                   0x00007fff54d3e902 _dispatch_worker_thread3 + 101
    12  libsystem_pthread.dylib             0x00007fff550001ca _pthread_wqthread + 1387
    13  libsystem_pthread.dylib             0x00007fff54fffc4d start_wqthread + 13
), NSLocalizedRecoverySuggestion=Please unlock your device and reattach. (0xE80000E2)., NSLocalizedFailureReason=Please unlock your device and reattach. (0xE80000E2).}) {
    NSLocalizedDescription = "Development cannot be enabled while your device is locked.";
    NSLocalizedFailureReason = "Please unlock your device and reattach. (0xE80000E2).";
    NSLocalizedRecoverySuggestion = "Please unlock your device and reattach. (0xE80000E2).";
    "com.apple.dtdevicekit.stacktrace" = (
    0   DTDeviceKitBase                     0x0000000116c26a0d DTDKCreateNSError + 113
    1   DTDeviceKitBase                     0x0000000116c27251 DTDK_AMDErrorToNSError + 1135
    2   DTDeviceKitBase                     0x0000000116c681b7 -[DTDKMobileDeviceToken mountDeveloperDiskImage:withError:] + 782
    3   DTDeviceKitBase                     0x0000000116c68a6e -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 488
    4   IDEiOSSupportCore                   0x0000000116b4c495 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 133
    5   DVTFoundation                       0x000000010ada60eb __DVTDispatchGroupAsync_block_invoke + 806
    6   libdispatch.dylib                   0x00007fff54d447a2 _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x00007fff54d3cf64 _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x00007fff54d50110 _dispatch_continuation_pop + 599
    9   libdispatch.dylib                   0x00007fff54d478e0 _dispatch_async_redirect_invoke + 703
    10  libdispatch.dylib                   0x00007fff54d3eb56 _dispatch_root_queue_drain + 515
    11  libdispatch.dylib                   0x00007fff54d3e902 _dispatch_worker_thread3 + 101
    12  libsystem_pthread.dylib             0x00007fff550001ca _pthread_wqthread + 1387
    13  libsystem_pthread.dylib             0x00007fff54fffc4d start_wqthread + 13
);
}

代码构建和测试通过。

似乎运行来自Xcode的测试在所有平台"unlocks"模拟器中,当运行来自xcodebuild时错误不再出现命令行。

我遇到了同样的问题,错误日志清楚地指出了问题,这是一个锁定的 iOS 设备。当您 运行 在设备处于活动状态且未锁定的情况下进行编译时,不会发生错误。

我的问题是这样的。 找了很多都没有找到解决方案,我碰巧找到了,很适合我的情况。

但在我对发布单个屏幕应用程序和很少的组件工作感兴趣之前,即在相同的环境和移动和 macOS 中,一个完整的应用程序无法发布,简单的没问题。

太离谱了,但 "RemotePath" 末尾缺少“/”是我的问题。

错误-> RemotePath = StartUp/Documents

确定-> RemotePath = StartUp / Documents /

我没有遇到任何问题。