问题
I am try add facebook login to Flutter app. I am use flutter_facebook_login
. But when I try build for iOS give error:
Resolving dependencies of `Podfile`
[!] CocoaPods could not find compatible versions for pod "FBSDKLoginKit":
In Podfile:
flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`) was resolved to 0.0.1, which depends on
FBSDKLoginKit (= 4.39.1)
None of your spec sources contain a spec satisfying the dependency: `FBSDKLoginKit (= 4.39.1)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
pod repo update
Error running pod install
Error launching application on iPhone X.
I no install pod manually because flutter_facebook_login
readme say:
(Note: you can skip "Step 2: Set up Your Development Environment").
Anyone help? Thanks!
回答1:
According to this diegoveloper's answer flutter_facebook_login github issue.
https://github.com/roughike/flutter_facebook_login/issues/201
flutter clean
- Remove
ios/Podfile.lock
file - Go to the
Podfile
file and changed fromplatform :ios, '9.0'
toplatform :ios, '11.0'
(In my case, some libs don't support 11.0 and I use platform :ios, '9.0 then set deployment target in runner.xcsworkspace to 9.0 and it work.) - Go to the terminal ,
ios
directory and runpod install
- Run the project again.
回答2:
just update your podfile .
platform :ios, '11.0'
try to pod install again in terminal. pod install
回答3:
- open terminal and go to root package directory using
cd the_root_package_path
- type
flutter clean
- open
podfile
and uncomment :# platform :ios, '11.0'
- run
pod install
had the same problem, tried everything, this worked for me.
回答4:
I had this problem some time ago and I was able to solve this with a manual approach.
Make sure that you have in your pubspec.yaml
flutter_facebook_login: ˆ2.0.0
declared and getted.
In your project root directory
navigate to ios
> .symlinks
> plugins
> flutter_facebook_login
> ios
> flutter_facebook_login.podspec
You will change some fields inside flutter_facebook_login.podspec
.
s.version = '2.0.0'
and
s.dependency 'FBSDKLoginKit', '~> 4.29'
after this in your osx box inside of ios
directory of your project run pod deintegrate
and pod update
return to root project directory run flutter clean
and try to build your project again.
Here is an example of my flutter_facebook_login.podspec
that works fine into one of my projects. I hope it helps.
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'flutter_facebook_login'
s.version = '2.0.0'
s.summary = 'A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.'
s.description = <<-DESC
A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'FBSDKLoginKit', '~> 4.29'
# https://github.com/flutter/flutter/issues/14161
#s.static_framework = true
s.ios.deployment_target = '8.0'
end
来源:https://stackoverflow.com/questions/55596988/flutter-facebook-login-cocoapods-dependency-error