ios - 每次 pod 更新时 SWIFT_VERSION 错误
问题描述
每次我更新 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 允许 swift 最多运行 4.2。
Swift 5.0 将不支持,必须将其降至 4.2 版本才能兼容并在模拟器或设备上运行应用程序。
解决方案
将此添加到您的Podfile
. 在里面插入你想要的 pod{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
推荐阅读
- azure-aks - 通过 jenkins 在 GitLab 中为每个分支/拉取请求动态创建 K8s (AKS) 命名空间
- html - 如何仅使 tbody 在具有动态列宽的表中垂直滚动
- java - 使用 pdfTron 创建带有参数 Inputstream 的 PDFDoc 的问题
- shell - TCL 脚本查找脚本并在搜索字符串之前添加新文本
- swift - SwiftUI - 如果在 ForEach 循环内
- sql - SQL LEFT JOIN 与另一个 JOIN 的结果
- sql - 如何在 Server SQL 中正确列出此特定结构的所有表
- css - CSS - 将几个文本居中
- python - 如何从字符串中查找子字符串的开始和结束索引
- php - 保存没有 id 的 eloquent 模型实例