我有一个 2.3 版 swift 的应用。
当我尝试在 xcode 8 中运行并在build设置中设置“User Legacy Swift -> YES”时,它只给我 cocoapods 错误。
见下图:
我的 pod 文件:
platform :ios, '8.0'
use_frameworks!
target 'xxx' do
pod 'Alamofire', '~> 3.3'
pod 'PKHUD', '~> 3.1'
pod 'SCLAlertView', '~> 0.5'
pod 'SwiftyJSON', '~> 2.3'
pod 'ICSPullToRefresh', '~> 0.4'
pod 'ReachabilitySwift', '~> 2.3'
pod 'IQKeyboardManagerSwift', '~> 4.0'
end
target 'xxTests' do
end
target 'xxUITests' do
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
最佳答案
这基本上意味着 pod 是为与当前项目不同的 swift 版本构建的。
在我的例子中,我的应用迁移到了 Swift 3,但我的 pod 仍然使用 Swift 2.3,因为它们还没有适应 Swift 3。您可以在此处执行以下两项操作之一:
- 通过转到“编辑”>“转换”>“当前 Swift 语法”,将您的 pod 更改为 Swift 3(或任何最新的 Swift 版本)。
- 将您的主项目降级回旧版本的 Swift。
我希望这能对这个问题有所启发。
关于ios - 使用旧版 Swift 语言版本”(SWIFT_VERSION)不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39565951/