每次Pod更新时出现SWIFT_VERSION错误

时间:2020-01-04 14:44:13

标签: ios swift cocoapods

每次更新Podfile时,都必须修复此SWIFT_VERSION错误才能解决。

如何将Pod和Swift版本设置为唯一,以便每次更新Pod时都无需修复SWIFT_VERSION错误。

Error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2.  (in target 'paper-onboarding')

由于操作系统的限制,X-Code允许最多运行4.2。

Swift 5.0将不支持,必须将其降到4.2版本以兼容并在模拟器或设备上运行应用程序。

1 个答案:

答案 0 :(得分:0)

Podfile中的广告连播定义下方添加此内容。 在{pod-name}中插入所需的广告连播,然后设置所需的版本

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == '{pod-name}'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.0'
      end
    end
  end
end