2016-11-09 26 views
0

我目前将Podfile中的遗留设置为SWIFT_VERSION = 2.3,但我使用的一些库是Swift 3.0,这意味着我需要手动将遗留的所有Swift 3.0豆荚遗留到No每个pod install。如何在Podfile安装程序中配置每个吊舱版本?如何为Podfile中的每个Pod设置Legacy Swift版本Xcode 9.0 Swift 3.2/Swift 4.0

这是我设置:

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 

如果我设置config.build_settings['SWIFT_VERSION'] = '3.0',比我们有Swift 2.3豆荚的问题。最好的解决方案是,如果我们单独设置每个pod传统版本以避免手动设置它。

回答

5

我发现这个搜索时如何将SWIFT_VERSION设置为3.2的Xcode 9

使用AirMapSDK本身和多个依赖需要3.2而不是4.0以下是如何为他人荚具体SWIFT_VERSION为例这可能会遇到这个问题。

post_install do |installer| 
    installer.pods_project.targets.each do |target| 
     if ['AirMapSDK', 'PhoneNumberKit', 'Lock', 'RxSwift', 'RxSwiftExt', 'RxCocoa', 'RxDataSources', 'ProtocolBuffers-Swift'].include? target.name 
      target.build_configurations.each do |config| 
       config.build_settings['SWIFT_VERSION'] = '3.2' 
      end 
     end 
    end 
end 

您可以更改if数组以指定您需要设置版本的任何窗口。

相关问题