Getting an error: "Swift does not support the SDK 'iPhoneSimulator11.2.sdk'" on Xcode 10

Getting an error: "Swift does not support the SDK 'iPhoneSimulator11.2.sdk'" on Xcode 10

我正在尝试在 Xcode 10 中创建一个全新的 Swift 项目。 但它给了我构建错误。这是我得到的确切错误:

<未知>:0: 错误: Swift 不支持 SDK 'iPhoneSimulator11.2.sdk' 命令编译Swift源失败,退出代码非零

当您同时安装了多个 Xcode 版本并且更新后您只剩下最后一个版本时,就会发生这种情况。解决方案是

从该目录中删除 iPhoneOS11.2.sdk:

Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

待办事项列表:

  1. quit xcode
  2. delete
  3. clean
  4. build project again