我可以设置CocoaPods框架的swift版本吗?

Yen*_*nos 1 xcode cocoapods swift swift4 xcode9

我对我更新的cocoapods有一些疑问.

我的xcode项目基于swift 4.0(xcode 9).

当我安装cocoapods(使用pod install)时,Installed frameworks会自动设置swift 4.0版本.(这些框架仅支持swift 3.x)

为什么会这样?当pod安装时,我该如何自动设置.

请给我一个提示.

谢谢

小智 5

将其添加到您的pod文件并设置Swift版本(例如3.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'] = '3.0'
            end
        end
    end
end
Run Code Online (Sandbox Code Playgroud)