8

我正在尝试将 facebook 登录添加到 Flutter 应用程序。我正在使用flutter_facebook_login。但是当我尝试为 iOS 构建时给出错误:

    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.

我没有手动安装 pod,因为flutter_facebook_login自述文件说:

(注意:您可以跳过“第 2 步:设置您的开发环境”)。

有人帮忙吗?谢谢!

4

4 回答 4

23

根据这个diegoveloper的回答flutter_facebook_login github问题。

https://github.com/roughike/flutter_facebook_login/issues/201

  • flutter clean
  • 删除ios/Podfile.lock文件
  • 转到Podfile文件并从更改platform :ios, '9.0'platform :ios, '11.0' (在我的情况下,一些库不支持 11.0,我使用平台:ios,'9.0 然后将 runner.xcsworkspace 中的部署目标设置为 9.0 并且它可以工作。)
  • 转到终端,ios目录并运行pod install
  • 再次运行项目。
于 2019-11-05T16:22:14.730 回答
4

只需更新您的 podfile 。

platform :ios, '11.0'

尝试在终端中再次安装 pod。吊舱安装

于 2020-06-30T05:35:20.403 回答
2
  1. 打开终端并使用cd the_root_package_path
  2. 类型flutter clean
  3. 打开podfile并取消注释: # platform :ios, '11.0'
  4. pod install

有同样的问题,尝试了一切,这对我有用。

于 2020-08-17T11:56:17.047 回答
0

前段时间我遇到了这个问题,我可以通过手动方法解决这个问题。确保你已经在你的pubspec.yaml flutter_facebook_login: ˆ2.0.0声明中得到了。

在您的项目root directory中导航到ios> .symlinks> plugins> flutter_facebook_login> ios>flutter_facebook_login.podspec

您将更改内部的一些字段flutter_facebook_login.podspec

s.version          = '2.0.0'

s.dependency 'FBSDKLoginKit', '~> 4.29'

在此之后,在您的项目目录内的 osx 框中ios运行pod deintegratepod update返回到根项目目录运行flutter clean 并尝试再次构建您的项目。

这是我的一个例子,flutter_facebook_login.podspec它在我的一个项目中运行良好。我希望它有所帮助。

# 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 &amp; 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
于 2019-04-09T16:44:20.660 回答