Xcode 12:针对iOS 10.0进行编译,但模块“ RxSwift”的最低部署目标为iOS 12.0

问题描述

我刚刚将Xcode更新为最新版本,并且该项目不再编译。我删除了所有内容并尝试重建Pod,但是最终遇到了与该问题相同的问题:

[x] /Users/alouanemed/Projects/App-iOS/Pods/_Prebuild/Moya/Sources/RxMoya/MoyaProvider+Rx.swift:2:8: 为iOS 10.0进行编译,但模块“ RxSwift”的部署最少 iOS 12.0的目标: /Users/alouanemed/Projects/App-iOS/Pods/build/Release-iphoneos/RxSwift/RxSwift.framework/Modules/RxSwift.swiftmodule/arm64-apple-ios.swiftmodule

导入RxSwift ^

解决方法

使用cocoapods和Xcode 12,当前,您需要在所谓的“安装后挂钩”中设置Pods的部署目标。

尝试将其添加到Podfile的末尾:


deployment_target = '12.0'

post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
            end
        end
        project.build_configurations.each do |bc|
            bc.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
        end
    end
end
,

您要导入的版本RxSwift的最低部署目标已设置为iOS 12.0,而您的项目本身仍在iOS 10.0上。

这不应与Xcode或Xcode更新有关。

如果您可以发布Podfile,我们可以进行验证。

,

只对那些可能和我一样的人告终。出现此错误的原因是我正在使用beta频道。切换到stable频道后,我跑了

cd ios/
pod deintegrate
pod cache clean --all
cd ..
flutter clean

然后,我删除了PodfilePodfile.lock。然后,我再次构建了项目,它成功了!