首页 > 解决方案 > swift 5 中没有这样的模块“FacebookCore”

问题描述

作为 iOS 开发学习过程的一部分,我正在做自己的测试应用程序(在 Xcode 11.0 上使用 swift 5)。我想在我的登录页面上添加使用 Facebook 登录,但在导入库时我不断收到没有这样的模块“FacebookCore” 。

在此处输入图像描述

我按照developer.facebook上的说明尝试使用 cocoaPods 实现 SDK,这是我的 Podfile

 # Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'TestApp' do

  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestApp
  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'

  target 'TestAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'TestAppUITests' do
    # Pods for testing
  end

end

按照 Facebook 的指示执行 pod install 并在我的 info.plist 中添加数据后,我可以清楚地看到该框架已链接到Link Binary With Libraries部分

在此处输入图像描述

但是,我似乎无法导入 FacebookCore 或 FacebookLogin。

PS:我尝试了几种解决方案,例如:

1-运行 .xcworkspace 而不是 .xcodeproj

2-即使显示错误也构建项目(有人说它会消失)

但他们都没有工作。

我怀疑问题出在我的框架搜索路径中,但为什么它首先会出错?所以我可能错了,无论如何,这是我的搜索路径的屏幕截图:

在此处输入图像描述

标签: swiftxcodecocoapodsfacebook-loginfacebook-sdk-4.x

解决方案


Use FBSDKCoreKit instead of FacebookCore

This are the correct pods

  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'

and your imports should be

import FBSDKCoreKit
import FBSDKLoginKit

in previous version there was FacebookCoore as wrapper for the FBSDKCoreKit classes. It looks like Facebook has removed this since v5.x.


推荐阅读