我对我更新的cocoapods有一些疑问。
我的Xcode项目基于Swift 4.0(Xcode 9)。
当我安装cocoapods(使用pod install
)时,安装的框架会自动设置Swift 4.0版本。 (这些框架仅支持Swift 3.x)
为什么会这样?当pod安装时,如何自动设置?
将其添加到您的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
Pod是版本控制工具,版本是来自提供者的SDK版本,而不是软件语言版本(例如,swift 3,3.1 oe 4等)
如果您提到版本,它将从提供程序下载特定版本的SDK。它将尝试使SDK与您的代码一起使用,但它存在软件语言版本问题,它对您没有多大帮助。
在这种情况下你需要做的是在Github上分叉SDK,然后更改你的分叉版本并签入。然后要求Pod下载你的修改版本。