ios 未找到 FBSDKCoreKit/FBSDKCoreKit.h 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30136279/
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
FBSDKCoreKit/FBSDKCoreKit.h not found error
提问by M Swapnil
I am implementing FB Login so i Downloaded the SDK from https://developers.facebook.com/docs/ios.
then i drag n down FBSDKCoreKit
, FBSDKLoginKit
and FBSDKShareKit
frameworks into my project.
我正在实施 FB 登录,所以我从https://developers.facebook.com/docs/ios下载了 SDK 。然后我拖N个了FBSDKCoreKit
,FBSDKLoginKit
和FBSDKShareKit
框架到我的项目。
when i ran project it works fine. but when i closed and reopen it, then "FBSDKCoreKit/FBSDKCoreKit.h not found error"
appears. then again i copy paste FBSDKCoreKit
framework into my project's library
and error disappear and this process continues. anyone faced this problem before?
当我运行项目时,它工作正常。但是当我关闭并重新打开它时,就会"FBSDKCoreKit/FBSDKCoreKit.h not found error"
出现。然后我再次将粘贴FBSDKCoreKit
框架复制到我的项目库中,错误消失,这个过程继续。有人遇到过这个问题吗?
what should i do to solve this error?
我应该怎么做才能解决这个错误?
回答by etayluz
Make sure to follow this step:
确保按照以下步骤操作:
Deselect Copy items into destination group's folder. https://developers.facebook.com/docs/ios/getting-started/
取消选择将项目复制到目标组的文件夹中。 https://developers.facebook.com/docs/ios/getting-started/
Also, in your Build Settings, look at this field: "Framework Search Paths" You should have something like this:
此外,在您的构建设置中,查看此字段:“框架搜索路径”您应该有这样的内容:
/Users/[username]/Documents/FacebookSDK
/Users/[username]/Documents/FacebookSDK
or for a more general config
或者更通用的配置
~/Documents/FacebookSDK
~/Documents/FacebookSDK
Also, look at Finder and make sure that the framework is actually there
另外,查看 Finder 并确保该框架确实存在
回答by Mihriban Minaz
After updating Cocoapods 1.0.0
, I deleted pod.lock
and installed the current stable pod versions (4.7.0
to 4.11.0
) of FBSDKCoreKit
, FBSDKLoginKit
, FBSDKShareKit
更新之后Cocoapods 1.0.0
,我删除pod.lock
,并安装最新的稳定版本的吊舱(4.7.0
至4.11.0
)的FBSDKCoreKit
,FBSDKLoginKit
,FBSDKShareKit
Then i encounter the same error. What i did was:
然后我遇到了同样的错误。我所做的是:
Added Header Search Paths Build Settings in Xcode:
"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\" "${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit\" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"
在 Xcode 中添加标题搜索路径构建设置:
"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\" "${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit\" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"
Then i still had error for another file. Because XCode is using prebuild frameworks.
然后我仍然有另一个文件的错误。因为 XCode 使用的是预构建框架。
FBSDKCoreKit/FBSDKCopying.h not found
未找到 FBSDKCoreKit/FBSDKCopying.h
- Clean Build -> ??K (Shift + Command + K) - to clean builded frameworks.
- Clean Build Folder -> ???K (Option+Shift+Command+K)
- Close Xcode // important! - Otherwise it recreate the DerivedData for the current open project automatically
Run this command in terminal
rm -rf ~/Library/Developer/Xcode/DerivedData
Open XCode and build successfully
- Clean Build -> ??K (Shift + Command + K) - 清理构建的框架。
- 清理构建文件夹 -> ???K(Option+Shift+Command+K)
- 关闭 Xcode // 重要!- 否则它会自动为当前打开的项目重新创建 DerivedData
在终端中运行此命令
rm -rf ~/Library/Developer/Xcode/DerivedData
打开XCode并构建成功
回答by maufadel
I got to solve this by deleting the Framework and adding it again by right click on the project->Add files..., then choose the framework and SELECT the option to Copy files if needed. I know it's not what Facebook recommends, but I couldn't make it work doing that, but this way it worked! I'm using v4.6 of FBSDK and Xcode 7 beta 6. Hope it helps you and everyone else who's facing the same problem :)
我必须通过删除框架并通过右键单击项目-> 添加文件... 再次添加它来解决这个问题,然后选择框架并选择复制文件(如果需要)的选项。我知道这不是 Facebook 推荐的,但我无法做到这一点,但这样就奏效了!我正在使用 FBSDK 的 v4.6 和 Xcode 7 beta 6。希望它可以帮助您和其他面临相同问题的人:)
回答by appsthatmatter
This also took me hours of pain! Finally I found the root problem.
这也花了我几个小时的痛苦!最后我找到了根本问题。
The Facebook SDK MUSTbe located at ~/Documents/FacebookSDK
Facebook SDK必须位于 ~/Documents/FacebookSDK
This is because in the RCTFBSDK project this path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDKproject (it will be shown in the error console)!
这是因为在 RCTFBSDK 项目中,此路径是硬编码的。但是您可以通过将其添加到RCTFBSDK项目的框架搜索路径中来添加您的自定义位置(它将显示在错误控制台中)!
回答by karan
FB developerssay don't select copyfiles. Which creates problem. But I did opposite.
FB 开发人员说不要选择复制文件。这会产生问题。但我恰恰相反。
I selected copy items if needed. It copied Frameworks in my project. Also automatically
Search Path
was added byxcode 7.2
.Also double check if there is nothing in
Framework Search Paths
underSearch Paths
underBuild Settings
fields, then just add $(PROJECT_DIR) which is equal to /Users/user/Documents/....PROJECT..DIR...
如果需要,我选择了复制项目。它在我的项目中复制了框架。也
Search Path
由自动添加xcode 7.2
。还要仔细检查下字段
Framework Search Paths
下 是否没有任何内容,然后只需添加 $(PROJECT_DIR) 等于 /Users/user/Documents/....PROJECT..DIR ...Search Paths
Build Settings
Compiled in 2 projects successfully.
成功编译2个项目。
回答by user9728668
I had to move FacebookSDK path in Framework Search Paths above $(PROJECT_DIR)
我不得不在 $(PROJECT_DIR) 上方的框架搜索路径中移动 FacebookSDK 路径
$(SRCROOT)/../../../Documents/FacebookSDK
$(inherited)
$(PROJECT_DIR)
回答by ishab acharya
For React Native devs:
对于 React Native 开发者:
Recommended steps to be done :
建议的步骤:
1.Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.
2)Make sure that FBSDK[Core, Login, Share]Kit.frameworkshow up in the Link Binary with Libraries section of your build target's Build Phases.
1.确保 Facebook SDK 框架安装在 ~/Documents/FacebookSDK 中。
2) 确保FBSDK[Core, Login, Share]Kit.framework出现在你的构建目标的构建阶段的 Link Binary with Libraries 部分。
3)Make sure Framework Search Pathof your build target's Build Settings is
3)确保构建目标的构建设置的框架搜索路径是
$(HOME)/Documents/FacebookSDK
$(HOME)/Documents/FacebookSDK
instead of
代替
~/Documents/FacebookSDK
If it still doesn't work for you then:
如果它仍然不适合你,那么:
1)sudo chmod -R 755 ~/Documents/FacebookSDK
1)sudo chmod -R 755 ~/Documents/FacebookSDK
2) set the path of framework search path of RCTFBSDK.xcodeprojto
2)设置RCTFBSDK.xcodeproj的框架搜索路径为
$(HOME)/Documents/FacebookSDK
(under libraries of your project folder ) set RCTFBSDK framework searchpath as here
(在您的项目文件夹的库下) 将 RCTFBSDK 框架搜索路径设置为此处
clean your project (command+ shift + k ) and build.
清理您的项目(command+ shift + k )并构建。
回答by Bruno Lemos
If any of the above answers didn't work, try this:
如果上述任何答案都不起作用,请尝试以下操作:
Open your ~/Documents/FacebookSDK
folder.
Check if there is this cloud icon right of the filenames:
打开你的~/Documents/FacebookSDK
文件夹。检查文件名右侧是否有这个云图标:
If so, macOS removed your files from your computer and uploaded them to iCloud! (thanks Apple)
如果是这样,macOS 会从您的计算机中删除您的文件并将它们上传到 iCloud!(感谢苹果)
You can:
你可以:
- Click on all the cloud icons, it will download the files back
- Disable Storage Optimization on your mac to prevent it from happening again
- 单击所有云图标,它将下载文件
- 禁用 Mac 上的存储优化以防止它再次发生
回答by Rajan Maharjan
Solution to the problem if your FacebookSDK is different than
如果您的 FacebookSDK 与
~/Documents/FacebookSDK
〜/文件/ FacebookSDK
Because you don't want iCloud Drive to load up with FacebookSDK; you have to change the "Framework Search Paths" for the added
因为您不希望 iCloud Drive 加载 FacebookSDK;您必须更改添加的“框架搜索路径”
react-native-fbsdk
react-native-fbsdk
This is because in the RCTFBSDK.xcodeproj inside Libraires; path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project.
这是因为在 Libraires 里面的 RCTFBSDK.xcodeproj 中;路径是硬编码的。但是您可以通过将自定义位置添加到 RCTFBSDK 项目的框架搜索路径来添加自定义位置。
- Select the Project
- Libraries
- Select "RCTFBSDK.xcodeproj"
- Build Settings
- Add your custom path in "Framework Search Paths" eg: /Users/rajanmaharjan/FacebookSDK
- Clean Build -> ??K (Shift + Command + K) - to clean build frameworks.
- Build the project; it should build successfully.
- 选择项目
- 图书馆
- 选择“RCTFBSDK.xcodeproj”
- 构建设置
- 在“框架搜索路径”中添加您的自定义路径,例如:/Users/rajanmaharjan/FacebookSDK
- Clean Build -> ??K (Shift + Command + K) - 清理构建框架。
- 构建项目;它应该成功构建。
回答by tbago
I have the same issue.I use Facebook SDK version 4.10.0.
I known my solution is not good but worked for me. I changed the Facebook source code.
Changed the import file path from #import <FBSDKCoreKit/FBSDKCoreKit+Internal.h>
to #import <FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h>
我有同样的问题。我使用 Facebook SDK 版本 4.10.0。
我知道我的解决方案不好,但对我有用。我更改了 Facebook 源代码。将导入文件路径从 更改#import <FBSDKCoreKit/FBSDKCoreKit+Internal.h>
为#import <FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h>