Xcode 9: Swift 依赖分析错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45079502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:07:46  来源:igfitidea点击:

Xcode 9: Swift dependency analysis error

iosswiftxcodexcode9-beta

提问by renraku

I have an iOS-app written in obj-C and UI-tests for the app in Swift. I recently installed Xcode 9 beta 2 and wanted to compile the app. I get the following error:

我有一个用 obj-C 编写的 iOS 应用程序和 Swift 应用程序的 UI 测试。我最近安装了 Xcode 9 beta 2 并想编译该应用程序。我收到以下错误:

"Dependency Analysis Error > The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor."

“依赖项分析错误 > “Swift 语言版本”(SWIFT_VERSION) 构建设置必须设置为使用 Swift 的目标支持的值。可以在构建设置编辑器中设置此设置。”

Screenshot added

添加了截图

When I go to build settings there isn't any possibility to set a version for Swift language. Does this represent a bug? Furthermore the app itself doesn't use Swift, only the automated UI_tests.

当我去构建设置时,不可能为 Swift 语言设置一个版本。这是否代表一个错误?此外,应用程序本身不使用 Swift,只使用自动化的 UI_tests。

采纳答案by Norolim

It tells that you need to specify the swift version in Build Settings. Just click project and go to Build settings (not the target) and set "Swift Language Version"to Swift 3.2or Swift 4. Here you have an screenshot :)

它告诉您需要在 Build Settings 中指定 swift 版本。只需单击项目并转到构建设置(不是目标)并将“Swift Language Version”设置Swift 3.2Swift 4。在这里你有一个截图:)

enter image description here

在此处输入图片说明

回答by Jayprakash Dubey

First of all I would recommend you to use stable version of Xcode since beta may contain bugs.Xcode 9.2 version is available. You can download XIP file from this link.

首先,我建议您使用稳定版本的 Xcode,因为测试版可能包含错误。Xcode 9.2 版本可用。您可以从此链接下载 XIP 文件。

You can resolve this error by using below steps :

您可以使用以下步骤解决此错误:

  1. Select PROJECT
  2. Select Build Settings
  3. In Swift Language Versionsection select Swift 3.2or Swift 4.0depending on your requirement.
  4. Repeat same steps for TARGETSas well
  5. Now cleanthe project (shortcut : cmd + shift + k)
  6. Now this should build without an error
  1. 选择项目
  2. 选择构建设置
  3. Swift Language Version部分选择Swift 3.2Swift 4.0取决于您的要求。
  4. 重复同样的步骤具体目标,以及
  5. 现在清理项目(快捷键:cmd + shift + k
  6. 现在这应该 build without an error

Screenshot 1

截图 1

If you still get the same error then use below steps :

如果您仍然遇到相同的错误,请使用以下步骤:

  1. Quit Xcode(shortcut : cmd + Q)
  2. Open your project
  3. Clean project(shortcut : cmd + shift + k)
  1. 退出Xcode中(快捷键:cmd + Q
  2. 打开你的项目
  3. 清理项目(快捷键:cmd + shift + k