xcode 未找到 Facebook.h
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12807489/
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
Facebook.h not found
提问by zeeple
I am trying to work my way through a Facebook SDK book I got off Amazon. The coding starts with
#import "Facebook/Facebook.h"
And has you create a Facebook object almost immediately. I do not seem to have this file anywhere in my SDK. Is this book outdated already? It was just published last fall...
我正在尝试通过我从亚马逊上下来的 Facebook SDK 书来工作。编码开始于
#import "Facebook/Facebook.h"
并且您几乎立即创建了一个 Facebook 对象。我的 SDK 中的任何地方似乎都没有这个文件。这本书已经过时了吗?去年秋天刚出版...
回答by Clayton Selby
The following is up to date and has been a great resource for me: Getting Started with the Facebook SDK
以下内容是最新的,对我来说是一个很好的资源: Facebook SDK 入门
I use the following import for accessing the Facebook SDK:
我使用以下导入来访问 Facebook SDK:
#import <FacebookSDK/FacebookSDK.h>
It appears your environment does not have the Facebook framework. Download that here.
Update
更新
I have found the offical Facebook answer to this. Apparently these are deprecated headers that can still be used for backwards compatability.
我找到了官方的 Facebook 答案。显然,这些是已弃用的标头,但仍可用于向后兼容。
Note that at the bottom, if Xcode is having problems recognizing the import after you complete the steps below, restart XCode.
请注意,在底部,如果在完成以下步骤后 Xcode 无法识别导入,请重新启动 XCode。
Add the headers by dragging the DeprecatedHeaders folder from the FacebookSDK.framework/Versions/A/DeprecatedHeaders folder into the Frameworks section of your Project Navigator.
Choose 'Create groups for any added folders' and deselect 'Copy items into destination group's folder (if needed)'. This adds the headers as a reference.
Now, open up your app delegate header file and replace the Facebook framework import with the Facebook header import.
Change:
通过将 DeprecatedHeaders 文件夹从 FacebookSDK.framework/Versions/A/DeprecatedHeaders 文件夹拖动到项目导航器的 Frameworks 部分来添加标题。
选择“为任何添加的文件夹创建组”并取消选择“将项目复制到目标组的文件夹(如果需要)”。这将添加标题作为参考。
现在,打开您的应用程序委托头文件并将 Facebook 框架导入替换为 Facebook 头导入。
改变:
#import <FacebookSDK/FacebookSDK.h>
To:
到:
#import "Facebook.h"
This allows you to make call to the FBDialog classes. The Facebook.h header includes the header files.
Note: If you have any problems with Xcode recognizing the Facebook.h file, just close and reopen your Xcode project.
这允许您调用 FBDialog 类。Facebook.h 标头包括头文件。
注意:如果您在 Xcode 识别 Facebook.h 文件时遇到任何问题,只需关闭并重新打开您的 Xcode 项目即可。
回答by Divya Bharathi
Step 1: Select Blue icon vidhyasalai as shown in screenshot 1.
第 1 步:选择蓝色图标 vidhyasalai,如屏幕截图 1 所示。
Step 2:Select Targets-> vidhyasalai -> build settings - > Search paths
(if you can't find search path, use search tap to search)
第2步:选择Targets-> vidhyasalai -> build settings - > Search paths
(如果找不到搜索路径,请使用搜索点击进行搜索)
Step 3:select Serch paths->Framework search paths
第三步:选择搜索路径->框架搜索路径
Step 4:select and press return(enter)key
第 4 步:选择并按回车(回车)键
Step 5:Now remove $(PROJECT_DIR)
and press return(enter) key.Now it will be empty also expand and check for debug,adhoc and release,make sure all will be empty.
第 5 步:现在删除$(PROJECT_DIR)
并按回车(回车)键。现在它将为空也展开并检查调试,临时和发布,确保所有内容都为空。
Step 6:Repeat 5,6,7 of screenshot steps for this target second icon,expand and check for debug,adhoc and release,make sure all will be empty.
第六步:对这个目标第二个图标重复5、6、7的截图步骤,展开并检查debug、adhoc和release,确保全部为空。
Step 7:Right click framework,delete and select move to trash
第 7 步:右键单击框架,删除并选择移至垃圾箱
Step 8:Again Drag and drop attached framework in this mail you will get screen like screenshot 2, make sure “destination” as select the given radio button as per screen shot ref
第 8 步:再次在此邮件中拖放附加的框架,您将获得如屏幕截图 2 的屏幕,确保“目标”为根据屏幕截图参考选择给定的单选按钮
Step 9:
第 9 步:
Drag framework to the location under framework folder. Clean and build. Hope error was cleared
将框架拖到框架文件夹下的位置。清洁和建造。希望错误被清除
回答by Nikolay Shubenkov
This book is not outdated. May be you added framework as cocoapods?
这本书并不过时。你可以添加框架作为cocoapods吗?
Then to find this file in project you should write:
然后要在项目中找到这个文件,你应该写:
#import <Facebook-iOS-SDK/FacebookSDK/FacebookSDK.h>
Then just hold 'Command' button and press on it and you will get to it location
然后只需按住“命令”按钮并按下它,您就会到达它的位置
回答by lionserdar
You need to download and install the SDK and after that add the Facebokk framework to your project.
您需要下载并安装 SDK,然后将 Facebokk 框架添加到您的项目中。
Once you're done with that part you will be able to import FacebookSDK.
完成该部分后,您将能够导入 FacebookSDK。
heres' the link https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/
继承人的链接https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/
watch the video
看视频