Objective C 项目中的 Xcode 8.3 Swift 版本错误 (SWIFT_VERSION) [英] Xcode 8.3 Swift Version Error (SWIFT_VERSION) In Objective C Project
问题描述
我在纯 Objective C 项目中使用 Xcode 8.3 时出现以下错误.
I have been getting the following error with Xcode 8.3 in my pure Objective C project.
我无法找到解决方案,我的构建设置中没有 swift 参数,我也无法在线找到任何解决方案.
I have not been able to find a solution for this, there are no swift parameters in my build settings and I can not find any solutions online for this either.
有什么想法吗?几天前它构建得很好,我能看到的唯一区别是 xcode 更新了.
Any Ideas? This was building fine a few days ago, and the only difference I can see is that xcode updated.
需要为使用 Swift 的目标正确配置Swift 语言版本"(SWIFT_VERSION).使用 菜单选择 Swift 版本或使用 Build Settings 编辑器直接配置构建设置.
推荐答案
因此,答案是转到构建设置并单击左上角的 + 图标(如下面的屏幕截图所示).然后选择添加一个带有 SWIFT_VERSION
且值为 3.0
的用户定义参数.构建应用,它应该可以正常运行.
So the answer to this is to go to the build settings and click the + icon at the top left (as per screen shot below). Then choose to add a User Defined parameter with SWIFT_VERSION
and a value of 3.0
. Build the app and it should run fine.
我也将以下内容添加到我的 Pod 文件中,以自动对 Pod 依赖项构建设置执行相同的过程,尽管仅凭这一点并不能解决问题:
I also added the following to my Pod file too to automatically do the same process for the pod dependency build settings, although this alone did not resolve the problem:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
这篇关于Objective C 项目中的 Xcode 8.3 Swift 版本错误 (SWIFT_VERSION)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!