如何在Podfile中为特定Pod定义快速版本

时间:2018-07-31 13:26:18

标签: cocoapods

是否可以将下面的Podfile中名为“ SideMenuController”的pod的swift版本编译器设置为3.0版?如果是,那该怎么办?

use_frameworks!
platform :ios, '10.0'

def shared_pods

    pod 'Alamofire', '4.6.0'
    pod 'SideMenuController', '0.2.4'

end

3 个答案:

答案 0 :(得分:11)

post_install do |installer|
        installer.pods_project.build_configurations.each do |config|
            config.build_settings.delete('CODE_SIGNING_ALLOWED')
            config.build_settings.delete('CODE_SIGNING_REQUIRED')
        end
        installer.pods_project.targets.each do |target|
            if ['SideMenuController'].include? target.name
                target.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = '3.0'
                end
            end
        end
end

答案 1 :(得分:7)

尝试一下

# Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'

    target 'MyApp' do
      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!

      # Pods for MyApp

      pod 'SideMenuController', '~> 0.2.4'
      pod 'Alamofire', '~> 4.6.0'


    end
    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

答案 2 :(得分:0)

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == '<insert target name of your pod here>'
      target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '<insert swift version here>'
      end
    end
  end
end
相关问题