iOS/tvOS playground 失败 "Unable to find execution service for selected run destination"

iOS/tvOS playground fails with "Unable to find execution service for selected run destination"

迁移到 XCode 7.1 后,我无法在 iOS 和 tvOS 平台上使用 playground。只有 OS X 有效。最简单的游乐场代码产生错误消息:

Unable to find execution service for selected run destination

我怀疑这与 XCode 没有找到合适的模拟器有关,但是我不知道在哪里以及如何配置它。

我尝试了现有项目中的 playground,以及刚从启动画面新建的一个。

有什么想法是错误的吗?

更新:

检查控制台可以提供更多信息,但仍不清楚如何修复:

24/10/2015 10:16:10,193 lsd[279]: LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist
24/10/2015 10:16:10,212 com.apple.usbmuxd[82]: LOCKDOWN_V2_BONJOUR_SERVICE_NAME is _apple-mobdev2._tcp,8de107c0
24/10/2015 10:16:10,248 Xcode[819]:  DeveloperPortal: Using pre-existing current store at URL (file:///Users/courteouselk/Library/Developer/Xcode/DeveloperPortal%207.1.db).
24/10/2015 10:16:10,381 com.apple.CoreSimulator.CoreSimulatorService[461]: Requested phone is is not available for pairing.  Assuming it has the capability.
24/10/2015 10:16:10,384 com.apple.CoreSimulator.CoreSimulatorService[461]: Requested phone is is not available for pairing.  Assuming it has the capability.
24/10/2015 10:16:12,929 com.apple.usbmuxd[82]: _SendAttachNotification Device 80:ea:96:04:a5:da@fe80::82ea:96ff:fe04:a5da._apple-mobdev2._tcp.local. has already appeared on interface 4. Suppressing duplicate attach notification.
24/10/2015 10:16:13,311 GPUToolsAgent[832]: Mac Agent inited !!!
24/10/2015 10:16:14,287 Xcode[819]: <DYMobileDevice: 0x7ffbfd6b6320>: failed to acquire service transport reservation: Error Domain=DYAMDErrorDomain Code=-402653150 "(null)"
24/10/2015 10:16:14,447 Xcode[819]: [MT] IDEPlaygroundEditor: Error encountered attempting to run playground: Error Domain=IDEPlaygroundErrorDomain Code=1 "Unable to find execution service for selected run destination." UserInfo={NSLocalizedDescription=Unable to find execution service for selected run destination.}
24/10/2015 10:16:19,672 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,672 mdworker[255]: LaunchServices: Database mapping failed with result -10822, retrying
24/10/2015 10:16:19,672 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,673 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,673 mdworker[255]: LaunchServices: Database mapping failed with result -10822, retrying
24/10/2015 10:16:19,673 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,674 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,674 mdworker[255]: LaunchServices: Database mapping failed with result -10822, retrying
24/10/2015 10:16:19,674 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,674 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:19,674 mdworker[255]: LaunchServices: Database mapping failed with result -10822, retrying
24/10/2015 10:16:19,675 mdworker[255]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
24/10/2015 10:16:20,497 Xcode[819]: CompanionProxy: _SocketReadCallback:128 (0x0x700000117000): Failed to receive response from AMDevice 0x7ffbfe60cad0 {UDID = e4bfce5e11be0bcf730ada45b4d6ae81f1abdb01, device ID = 23, FullServiceName = 80:ea:96:04:a5:da@fe80::82ea:96ff:fe04:a5da._apple-mobdev2._tcp.local.}: 0xe8000084
24/10/2015 10:16:20,497 Xcode[819]: CompanionProxy: _SocketReadCallback:200 (0x0x700000117000): Stopped listening for paired devices from AMDevice 0x7ffbfe60cad0 {UDID = e4bfce5e11be0bcf730ada45b4d6ae81f1abdb01, device ID = 23, FullServiceName = 80:ea:96:04:a5:da@fe80::82ea:96ff:fe04:a5da._apple-mobdev2._tcp.local.}: 0xe8000084

删除 DerivedData 文件夹中的所有内容,~/Library/Developer/Xcode/DerivedData,然后重新启动 Xcode

好的,经过一番努力,这是解决方案。

  1. 清理文件夹~/Library/Developer/CoreSimulator
  2. 重启机器
  3. 试试 运行 一个 iOS 游乐场,它现在应该可以正常工作了。

注意: 在我的例子中,我将 CoreSimulator 重命名为 CoreSimulator.old,并且在重新启动后自动创建了一个新的 CoreSimulator(所以,我只是扔掉了 .old 一个)。

顺便说一句,/Root/DefaultDevices 下有一个包含完整模拟器列表的文件 ~/Library/Developer/CoreSimulator/Devices/device_set.plist。我认为这就是问题所在。

可能有更快的解决方案:

检查您在 Xcode 的设备中是否有 iPad Pro 模拟器。如果没有 - 通过添加模拟器选项添加它。

正如一些人在评论中指出的那样,您可能还需要重新启动 Xcode 或重新打开 playground。

要添加模拟器,请转至设备(Window > 设备)。单击 window 最左下角的 + 按钮,单击 "Add Simulator",然后从下拉列表中单击 select 适当的 "Device Type",然后单击 "Create"。

我能够在终端中使用以下两个命令解决此问题:

$ rm -rf ~/Library/Developer/CoreSimulator/Devices
$ killall -9 com.apple.CoreSimulator.CoreSimulatorService

添加所有模拟器在xcode--> window-->devices.

然后重新启动 xcode 它会正常工作

Xcode 8 次更新。 运行 转成类似邮件

"selected platform is not available"

playground 打开后,在 window 的右上角,右边最后一个图标:隐藏或显示实用程序。单击它,然后在该区域单击左侧的图标:Show File Inspector。

然后在 Playground Settings 弹出窗口中,它可能被设置为 unknown。将其更改为您选择的平台(OS 对我来说是 X)然后您就可以开始了。