需要为使用Swift的目标正确配置“使用旧版Swift语言版本”(SWIFT_VERSION)。 [英] “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift."
问题描述
自从我更新到Xcode 8.2(来自App Store的GM种子)以来,我一直陷于以下错误:
Ever since I've updated to Xcode 8.2 (GM seed, from the App Store), I have been stuck at the following error:
使用旧版Swift语言版本(SWIFT_VERSION)必须为使用Swift的目标正确配置
。使用[Edit>
Convert> To Current Swift Syntax…]菜单选择一个Swift版本,或者
使用Build Settings编辑器直接配置构建设置。
Use Legacy Swift Language Version" (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
所以我转到目标的构建设置,并搜索了 SWIFT_VERSION
,看看我在哪里犯错。但是,我很惊讶地发现它已经设置为 否
!
So I went to my target's Build Settings, and searched for SWIFT_VERSION
to see where I was erring. However, I was surprised to find that it was already set to No
!
我该如何解决?
推荐答案
Xcode 8似乎错误地显示了一个不存在的(幻像,如果可以的话) 否
。有一个简单的解决方法:
Xcode 8 seems to be wrongfully displaying a nonexistent ("phantom", if you will) No
. There's a trivial fix for this:
- 点击
SWIFT_VERSION $ c $旁边的小箭头c>
来切换下拉列表。 - 设置
Debug
的值和发布
到是
。 - 设置
Debug
和Release
返回否
。
- Click the tiny arrow next to
SWIFT_VERSION
to toggle the drop-down list. - Set the values for
Debug
andRelease
toYes
. - Set the values for
Debug
andRelease
back toNo
.
下图是在将 Debug
设置为 否
之后拍摄的>。 Xcode显示 Debug
和 Release
均设置为 否
,但是 SWIFT_VERSION
读取的是<多个值>
:
The image below was taken just after setting Debug
to No
. Xcode shows that both Debug
and Release
are set to No
, however SWIFT_VERSION
reads <Multiple Values>
:
由此,我只能得出结论,这是一个错误;并且某些值(或更可能是空值)被错误地表示为 No
。
From this, I can only conclude that it is a bug; and that some value (or more probably a null value) is being misrepresented as No
.
这篇关于需要为使用Swift的目标正确配置“使用旧版Swift语言版本”(SWIFT_VERSION)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!