找不到“FBSDKLoginKit/FBSDKLoginKit.h”文件(适用于 iOS v4.2 和 Xcode 7 的 Facebook SDK)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30745106/
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 07:15:41  来源:igfitidea点击:

'FBSDKLoginKit/FBSDKLoginKit.h' file not found (Facebook SDK for iOS v4.2 & Xcode 7)

iosxcodefacebookswiftfacebook-ios-sdk

提问by Farhad

I follow all the steps in This Tutorialand/or Facebook SDK Documentationto install Facebook Login on my App, but when I run the code I get an error. although Facebook mention I can just use import (Swift)to include the framework, I try to do it the old fashion as well with Objective-C Bridge Header.

我按照本教程和/或Facebook SDK 文档中的所有步骤在 我的应用程序上安装 Facebook 登录,但是当我运行代码时出现错误。尽管Facebook 提到我可以只使用 import (Swift)来包含框架,但我也尝试使用 Objective-C Bridge Header 以旧方式做到这一点。

Error:

错误:

'FBSDKLoginKit/FBSDKLoginKit.h' file not found

找不到“FBSDKLoginKit/FBSDKLoginKit.h”文件

Screenshot
As you can see the bridge.h is being read by the compiler, but due to internal file error it will throw error.

enter image description here

Screenshot
正如你所看到的,bridge.h 正在被编译器读取,但是由于内部文件错误,它会抛出错误。

在此处输入图片说明

Bridge.h
In Xcode 6 you don't require bridge header file, I could just do it with import

Bridge.h
在 Xcode 6 中你不需要桥头文件,我可以用import

#import <FBSDKLoginKit/FBSDKLoginKit.h>

This problem is due to Xcode 7 Beta, I have tried to do it on Xcode 6 and it worked perfectly with just an import FBSDKLoginKit. Can anyone tell me a hack around this? or if there is a way to convert my Swift 2 code back to 1.4 and work on Xcode 6.

这个问题是由于 Xcode 7 Beta 造成的,我曾尝试在 Xcode 6 上做到这一点,并且它只在一个import FBSDKLoginKit. 谁能告诉我一个黑客?或者是否有办法将我的 Swift 2 代码转换回 1.4 并在 Xcode 6 上工作。

采纳答案by CrazyGremlin

I have the same issue and recognized, that my old XCode 6 projects worked with the Facebook frameworks.

我有同样的问题并认识到,我的旧 XCode 6 项目与 Facebook 框架一起工作。

So i try the following workaround and that fixed the problem. however i don't know why:

所以我尝试了以下解决方法并解决了问题。但是我不知道为什么:

Facebook iOS SDK 4.2

Facebook iOS SDK 4.2

  1. Create a fresh project in XCode 6
  2. Link the Facebook Frameworks to your project as described in the docs
  3. Close the project and reopen it in XCode 7
  4. The "To Swift 2 Converter" should open within the project - Convert the project to Swift 2
  5. Run the project - in my case everything works fine.
  1. 在 XCode 6 中创建一个新项目
  2. 按照文档中的描述将 Facebook 框架链接到您的项目
  3. 关闭项目并在 XCode 7 中重新打开它
  4. “To Swift 2 Converter”应该在项目中打开 - Convert the project to Swift 2
  5. 运行项目 - 就我而言,一切正常。

After that i copied my "old" Swift 2 Files into the new project. The app starts without any issues.

之后,我将我的“旧”Swift 2 文件复制到新项目中。该应用程序启动时没有任何问题。

I observed the changes by the converter, but can't recognized any change depending the Facebook frameworks.

我观察到转换器的变化,但无法根据 Facebook 框架识别出任何变化。

回答by Darma

I had the same problem.

我有同样的问题。

Managed to sort the directory by adding the Facebook SDK in "Framework Search Path".

通过在“框架搜索路径”中添加 Facebook SDK 管理对目录进行排序。

Target -> Build Settings -> Framework Search Paths -> + /Users//Documents/FacebookSDK

目标 -> 构建设置 -> 框架搜索路径 -> + /Users//Documents/FacebookSDK

it works!

有用!

=]

=]

回答by Karlo A. López

For those using cocoapods the solution for me was actually adding FBSDKCoreKit to podfile:

对于那些使用 cocoapods 的人,我的解决方案实际上是将 FBSDKCoreKit 添加到 podfile:

pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'

The facebook documentationis incomplete, they dont mention anything about including FBSDKCoreKitpod reference.

facebook 文档不完整,他们没有提到任何关于包含FBSDKCoreKitpod 参考的内容。

回答by ishab acharya

For [login,sharekit,corekit].h file not found error , My solution was:

对于 [login,sharekit,corekit].h file not found 错误,我的解决方案是:

changing framework searchpath of RCTFBSDK (inside library of the project)

~/Documents/FacebookSDK 

to

$(HOME)/Documents/FacebookSDK

回答by Safin Ahmed

Had the same issue, instead of updating the search path I solved it by removing the Frameworks from the project and then adding them checking the Copy items if needed box

有同样的问题,我没有更新搜索路径,而是通过从项目中删除框架然后添加它们来解决它,如果需要,选中复制项目框

My header files looks this

我的头文件看起来像这样

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

回答by iiFreeman

You can simply put ~/Documents/FacebookSDKin Framework Search Paths and it will work for any user

您可以简单地~/Documents/FacebookSDK输入框架搜索路径,它适用于任何用户