Xcode 12: Compiling for iOS 10.0, but module 'RxSwift' has a minimum deployment target of iOS 12.0

Viewed 12187

I just updated Xcode to the latest version, and the project is no longer compiling. I removed everything and tried to rebuild pods but ended up having the same issue this issue:

[x] /Users/alouanemed/Projects/App-iOS/Pods/_Prebuild/Moya/Sources/RxMoya/MoyaProvider+Rx.swift:2:8: compiling for iOS 10.0, but module 'RxSwift' has a minimum deployment target of iOS 12.0: /Users/alouanemed/Projects/App-iOS/Pods/build/Release-iphoneos/RxSwift/RxSwift.framework/Modules/RxSwift.swiftmodule/arm64-apple-ios.swiftmodule

import RxSwift ^

3 Answers

With cocoapods and Xcode 12, you currently need to set your Pods' deployment targets in a so-called "post-install hook".

Try adding this to the end of your 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 |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
        end
    end
end

Just to people who may end up in the same case as me. The reason of this error was that I was using the beta channel. After switching to the stable channel, I ran

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

And, I removed the Podfile and the Podfile.lock. Then, I built the project again and it worked!

You are tying to import a version of RxSwift that has already set its minimum deployment target to iOS 12.0 while your project itself is still on iOS 10.0.

This should not be related to Xcode or the Xcode update.

If you can post your Podfile we can verify this.

Related