xcode 找不到模块 FBSDKCoreKit Cocoapods

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35527672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:33:53  来源:igfitidea点击:

Cannot find module FBSDKCoreKit Cocoapods

xcodeswiftfacebookcocoapods

提问by Jacob Ruth

I'm trying to integrate facebook into my app using CocoaPods, using the use_frameworks! tag, and according to facebook's instructions here, also included the pod bolts. When I try use import FBSDKCoreKitin my appdelegate, I get a no such module 'FBSDKCoreKit error. I've included my podfile below:

我正在尝试使用 use_frameworks 将 Facebook 集成到我的应用程序中,使用 CocoaPods!标签,并根据此处的facebook说明,还包括吊舱螺栓。当我尝试import FBSDKCoreKit在我的 appdelegate 中使用时,我得到一个没有这样的模块 'FBSDKCoreKit 错误。我在下面包含了我的 podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.2'
use_frameworks!
pod 'Bolts'
pod 'Alamofire', '~> 3.0'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'

Additionally, in my Pods folder, there is a question mark next to Bolts, FBSDKCoreKit, and FBSDKSharekit, but not one next to alamofire, which I had been using previously. In the Frameworks folder in my Pods project, FBSDKCoreKit and Bolts are listed there, but are both red. Any ideas? I've tried cleaning my project, and reinstalling and updating the pods.

此外,在我的 Pods 文件夹中,Bolts、FBSDKCoreKit 和 FBSDKSharekit 旁边有一个问号,但我之前使用过的 alamofire 旁边没有。在我的 Pods 项目的 Frameworks 文件夹中,FBSDKCoreKit 和 Bolts 列在那里,但都是红色的。有任何想法吗?我尝试清理我的项目,并重新安装和更新 pod。

采纳答案by Jacob Ruth

I fixed this by

我修复了这个

  1. Removing the Bridging Header. Facebook SDK doesn't need them anymore after version 4.1
  2. Adding all of the .frameworks to the Projects Build Phases -> Link Binary With Libraries
  3. Selecting each framework and building it. You can do this by selecting your project name next to the run arrow.
  4. Cleaning the project and restarting my computer.
  1. 删除桥接头。Facebook SDK 在 4.1 版本之后不再需要它们
  2. 将所有 .frameworks 添加到 Projects Build Phases -> Link Binary With Libraries
  3. 选择每个框架并构建它。您可以通过选择运行箭头旁边的项目名称来执行此操作。
  4. 清理项目并重新启动我的计算机。

回答by footyapps27

For people moving from Carthageto Cocoapodsmake sure to remove the Carthage references of the FBSDKCoreKitfrom the Link Binary With Librariesunder Build Phasesoption.

对于从这里搬迁的人,CarthageCocoapods确保FBSDKCoreKitLink Binary With Libraries下面的Build Phases选项中删除 的 Carthage 引用。

enter image description here

在此处输入图片说明

回答by Sazzad Hissain Khan

Please try below steps,

请尝试以下步骤,

  • Explicitly mention the versions i.e.
  • 明确提及版本即

pod 'FBSDKCoreKit', '~>5.8.0'

pod 'FBSDKShareKit', '~>5.8.0'

pod 'FBSDKLoginKit', '~>5.8.0'

pod 'FBSDKCoreKit', '~>5.8.0'

pod 'FBSDKShareKit', '~>5.8.0'

pod 'FBSDKLoginKit', '~>5.8.0'

  • Update pod repo using sudo pod repo update
  • Update pod using pod update
  • 使用更新 pod repo sudo pod repo update
  • 使用更新 pod pod update

回答by Catalina T.

Seems that the facebook pods are Objective-C and they need a special way of importing in a swift project.

似乎 facebook pods 是 Objective-C,他们需要一种特殊的方式来导入 swift 项目。

This is how I got it to work:

这就是我让它工作的方式:

Create a bridging header in your project, if you dont have one(I created a new header file called Bridging-Header.hand set it as a bridging header in the project settings, like in the screenshot) enter image description here

如果您没有,请在您的项目中创建一个桥接头(我创建了一个名为的新头文件Bridging-Header.h并将其设置为项目设置中的桥接头,如屏幕截图所示) 在此处输入图片说明

Then in this file import the facebook modules. Here's how my file looks like:

然后在这个文件中导入 facebook 模块。这是我的文件的样子:

#ifndef Bridging_Header_h
#define Bridging_Header_h

@import FBSDKCoreKit;
@import FBSDKLoginKit;

#endif /* Bridging_Header_h */

Let me know if this workout for you or you need more help.

如果此锻炼适合您或您需要更多帮助,请告诉我。

回答by Lipu Hossain

first add in pod file

首先添加pod文件

 pod 'FacebookCore'
 pod 'FacebookLogin'
 pod 'FacebookShare'

this is facebook swift library,after that before using FBSDKCoreKit,just use FacebookCore then import FBSDKCoreKit

这是 facebook swift 库,在使用 FBSDKCoreKit 之前,只需使用 FacebookCore 然后导入 FBSDKCoreKit