Fixing `CocoaPods could not find compatible versions for pod "flutter_facebook_auth"`
Today Flutter failed to compile my app to iOS with the following error:
% pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
firebase_analytics: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
firebase_database: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
firebase_dynamic_links: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '8.14.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "flutter_facebook_auth":
In Podfile:
flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
Specs satisfying the `flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)` dependency were found, but they required a higher minimum deployment target.
A few searches for that error return related tickets on GitHub, but none of them applied to me:
- https://github.com/darwin-morocho/flutter-facebook-auth/issues/140#issuecomment-904233169: this person got it working after installing ffi with Rosetta. This does not apply to me since I believe I had installed the native M1 version of ffi.
- https://github.com/darwin-morocho/flutter-facebook-auth/issues/140#issuecomment-903700508: this person recommends to look at the migration guide on Facebook Auth in Flutter's site. My app does not use Facebook Auth though.
- https://stackoverflow.com/questions/67283211/flutter-cocoapods-could-not-find-compatible-versions-for-pod-fbsdkcorekit: in this post, they recommend running clean up commands like
flutter clean
, deleting Podfile.lock, etc. This did not work for me.
So I resorted to reading the error itself. It says it requires a higher minimum deployment target. In my Podfile, the deployment target was 10, which up until now, was perfect.
I looked at flutter_facebook_auth's spec, and it said the following:
% cat ios/.symlinks/plugins/flutter_facebook_auth/ios/flutter_facebook_auth.podspec
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint flutter_facebook_auth.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_facebook_auth'
s.version = '3.5.3'
s.summary = 'Plugin to Facebook authentication for iOS in your Flutter app'
s.description = <<-DESC
Plugin to Facebook authentication for iOS in your Flutter app
DESC
s.homepage = 'https://meedu.app'
s.license = { :file => '../LICENSE' }
s.author = { 'meedu.app' => 'contacto@meedu.app' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'FBSDKCoreKit', '~> 13.0.0'
s.dependency 'FBSDKLoginKit', '~> 13.0.0'
s.platform = :ios, '11.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
end
See the s.platform = :ios, '11.0'
? So I changed the value in my Podfile from 10 to 11 and suddenly, pod install
started working again!
Unfortunately, during compilation, I got the following error:
Parse Issue (Xcode): Module 'file_saver' not found
[my_app]/ios/Runner/GeneratedPluginRegistrant.m:17:8
I found a few posts mentioning the error, and the most likely solution for my case is described here. Since I changed the platform version to 11, I need to do this in the deployment target too.
Indeed, in XCode, it was still set to 10
And after fixing this, it finally compiled successfully.