我对我更新的 cocoapods 有一些疑问。
我的 Xcode 项目基于 Swift 4.0 (Xcode 9)。
当我安装 cocoapods(使用 pod install
)时,安装的框架会自动设置 Swift 4.0 版本。 (这些框架只支持Swift 3.x)
为什么会这样? 以及如何在 pod install 时自动设置?
最佳答案
将此添加到您的 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
关于swift - 我可以设置 CocoaPods 框架 Swift 版本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47139719/