错误 运行 游乐场。无法找到合适的目标设备。 (iOS Swift)

Error running playground. Unable to find suitable target device. (iOS Swift)

我在 XCode 中创建了一个新项目。

文件 > 新建 > 游乐场 (option+shift+cmd+N)

我重新启动了我的 XCode 并重新启动了我的系统,但仍然是同样的错误。

尝试导航到 Xcode 菜单 Window >> devices (shift+cmd+2) 将弹出一个新的 window。

在左下角,添加一个新模拟器,特别​​是 iOS 8.0 上的一个 运行 到现有列表。

重新启动Xcode。

如@Mayank Gupta 所述,它致力于添加新模拟器并重新启动 XCode。

来自开发者论坛,这对我有用:

  1. Quit Xcode
  2. Delete the folder /Users/<username>/Library/Developer/CoreSimulator/Devices. For example, in Terminal: rm -rf ~/Library/Developer/CoreSimulator/Devices
  3. In Terminal: killall -9 com.apple.CoreSimulator.CoreSimulatorService (or just reboot).

Fox Xcode 7,我必须安装 iPad Air 或 iPad Air 2 才能使操场正常工作。

遇到该问题的另一种可能方法是在启动模拟器时让 Xcode 自动更新。

解决方法同上,但更礼貌:

  1. 退出 Xcode 和模拟器应用
  2. 运行 在终端中:killall -9 com.apple.CoreSimulator.CoreSimulatorService
  3. 启动 Xcode,发现现在一切都已修复。

当然,您可以重新启动。