ios Xcode 总是说找不到 'FBSDKShareKit/FBSDKShareKit'.h 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35590903/
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
Xcode always says ‘FBSDKShareKit/FBSDKShareKit’.h file not found
提问by Ivan
No matter what I do (I may be doing it wrong) When I try to build my unity IOS app for testing, Xcode always says ‘FBSDKShareKit/FBSDKShareKit'.h file not found.
无论我做什么(我可能做错了)当我尝试构建我的 unity IOS 应用程序进行测试时,Xcode 总是说找不到 'FBSDKShareKit/FBSDKShareKit'.h 文件。
I've added the Facebook SDK indicated in the Quick Start for iOS in the Xcode Project. From the Facebook SDK folder, dragged the folder FBSDKCoreKit.Framework, FBSDKLoginKit.Framework, FBSDKShareKit.Framework into your Xcode Projects Framework folder. Then configured info.plist as stated and of course supplied the bundle identifier. And it gives the same problem. Honestly I have spent more than 6 weeks on this single issue. I'm in the verge of mental and physical collapse and close to be fired. Please give some kind of advice. I've tried all the other answers in this same page but non work. Please help!!
我在 Xcode 项目中添加了 iOS 快速入门中指出的 Facebook SDK。从 Facebook SDK 文件夹中,将文件夹 FBSDKCoreKit.Framework、FBSDKLoginKit.Framework、FBSDKShareKit.Framework 拖到您的 Xcode Projects Framework 文件夹中。然后按照说明配置 info.plist,当然还提供了包标识符。它给出了同样的问题。老实说,我在这个单一问题上花了超过 6 周的时间。我处于精神和身体崩溃的边缘,差点被解雇。请给一些建议。我已经尝试了同一页面中的所有其他答案,但没有用。请帮忙!!
回答by Stefano Cremona
I had this problem with XCode 10!!! Sorted in this way:
我在使用 XCode 10 时遇到了这个问题!!!以这种方式排序:
- Select
Libraries > RCTFBSDK.xcodeproj
- Select
Build Settings > Framework Search Paths
- Replace the
~/Documents/FacebookSDK
to$(HOME)/Documents/FacebookSDK
(with parentheses!)
- 选择
Libraries > RCTFBSDK.xcodeproj
- 选择
Build Settings > Framework Search Paths
- 替换
~/Documents/FacebookSDK
to$(HOME)/Documents/FacebookSDK
(带括号!)
Believe it or not, now it works!
信不信由你,现在它起作用了!
回答by Lolloz89
If you're here because you're trying to use facebook/react-native-fbsdk, then you only need to add the following line to your Podfile:
如果您在这里是因为您尝试使用 facebook/react-native-fbsdk,那么您只需要将以下行添加到您的 Podfile 中:
pod 'FBSDKShareKit'
Then
然后
pod install
pod install
Build and run!
构建并运行!
回答by Hyman Diff
I got the same issue and solve problem.<> My solution : 1. follow the steps from https://developers.facebook.com/docs/react-native/getting-started-ios2. check the xcode proj -> Library, find and open file RCTFBSDK.xcodeproj then update fb sdk path in build setting->Framework search path.
我遇到了同样的问题并解决了问题。<> 我的解决方案:1. 按照https://developers.facebook.com/docs/react-native/getting-started-ios2. 检查 xcode proj -> 库中的步骤, 找到并打开文件 RCTFBSDK.xcodeproj 然后在构建设置->框架搜索路径中更新 fb sdk 路径。
It works. I guess that sometime the RCTFBSDK.xcodeproj in Library can not update the framework search path from main xcodeproj so we need done manually. Hopefully my solution can help you, Thanks.
有用。我猜有时库中的 RCTFBSDK.xcodeproj 无法从主 xcodeproj 更新框架搜索路径,因此我们需要手动完成。希望我的解决方案能帮到你,谢谢。
回答by Ivan
Drekka I was finally out of the game, until I read this answer and it gave my an Idea to try something different. This is what finally worked for me: The Framework Search Path was set wrong I it was such I tiny detail I wuold never noticed it if I was wasn't obsessed about it: In target - build settings - search paths - frameworks search paths change from:
Drekka 我终于退出了游戏,直到我阅读了这个答案,它给了我一个尝试不同的想法。这就是最终对我有用的方法:框架搜索路径设置错误我是如此微小的细节,如果我不着迷,我从未注意到它:在目标 - 构建设置 - 搜索路径 - 框架搜索路径更改从:
$(inherited) $(PROJECT_DIR)/Frameworks\Plugins/iOS/Facebook (look at the wrong direction of the first slash)
$(inherited) $(PROJECT_DIR)/Frameworks\Plugins/iOS/Facebook(看第一个斜杠方向不对)
to
到
$(SCROOT) $(inherited) $(PROJECT_DIR)/Frameworks/Plugins/iOS/Facebook
$(SCROOT) $(继承) $(PROJECT_DIR)/Frameworks/Plugins/iOS/Facebook
This is finally it I can go to sleep now!Thanks drekka!
终于可以睡觉了!谢谢 drekka!
回答by Luke Brandon Farrell
If you think you've done everything right but it still is not working, then make sure the FB [LoginKit, ShareKit, and CoreKit] are in your "Copy Bundle Resources".
如果您认为自己已经做对了一切,但仍然无法正常工作,请确保 FB [LoginKit、ShareKit 和 CoreKit] 在您的“复制捆绑资源”中。
This took me hours to figure out, hope it can help others!
这花了我几个小时才弄明白,希望它可以帮助别人!
回答by drekka
Hard to tell what your problem is and I've never used those frameworks. But it sounds like you may have added them to the project in terms of linking against them during compilation, but they are not being added to the final app bundle.
很难说你的问题是什么,我从来没有使用过这些框架。但听起来您可能已将它们添加到项目中,以便在编译期间链接它们,但它们并未添加到最终的应用程序包中。
This may or may not help, but based on what you have said, it's what I would look at. Check your 'Build Phases'. You should see the frameworks in the 'Link Binary With Libraries' phase. You then need to look for a phase ( or add one if it's not there) which is a 'Copy files Phase'. Add one by choosing 'New Copy Files Phase' after clicking the '+' at the top of the list.
这可能有帮助,也可能无济于事,但根据你所说的,这就是我会看的。检查您的“构建阶段”。您应该在“Link Binary With Libraries”阶段看到框架。然后,您需要查找一个阶段(如果不存在,则添加一个),即“复制文件阶段”。单击列表顶部的“+”后,通过选择“新建复制文件阶段”来添加一个。
In the 'Copy Files Phase', set the 'Destination' to 'Frameworks' and then add the Facebook frameworks to the list of file to copy.
在“复制文件阶段”中,将“目标”设置为“框架”,然后将 Facebook 框架添加到要复制的文件列表中。
Another option which may also work if the above doesn't is to check the 'Runpath Search Paths' in your build settings. If it's not set, try setting it to '@executable_path/Frameworks @loader_path/Frameworks'.
如果上述方法无效,另一个可能也可以使用的选项是检查构建设置中的“运行路径搜索路径”。如果未设置,请尝试将其设置为“@executable_path/Frameworks @loader_path/Frameworks”。
Hope this helps.
希望这可以帮助。
回答by sonlexqt
On macOS, in my case, I followed all the instructions but I still got the error. I check again, the files were "there":
在 macOS 上,就我而言,我按照所有说明进行操作,但仍然出现错误。我再次检查,文件在“那里”:
But actually they're on my iCloud account instead (notice the ones with a little cloud icon). So I downloaded those files to my disk and the app successfully compiled !
但实际上它们在我的 iCloud 帐户中(注意带有小云图标的那些)。所以我将这些文件下载到我的磁盘上,应用程序成功编译!
回答by Parth Patel
All of the above answers ended up not working for me. What did work in the end was changing the Facebook SDK folder name to FacebookSDK and moving it to Documents on my Macbook. Remember to also change the Frameworks search path under build settings accordingly.
以上所有答案最终都不适合我。最终起作用的是将 Facebook SDK 文件夹名称更改为 FacebookSDK 并将其移动到我的 Macbook 上的 Documents。请记住还要相应地更改构建设置下的框架搜索路径。
回答by Kari
I got this error while building game for iOS via Unity3D.
我在通过 Unity3D 为 iOS 构建游戏时遇到了这个错误。
Basically newer versions of facebook sdk do not include frameworks, it is expected of you to download them using cocoapods.
基本上较新版本的 facebook sdk 不包含框架,希望您使用 cocoapods 下载它们。
So, after compiling via unity while on windows, I copied my resulting folder and pasted it into my macbook.
因此,在 Windows 上通过 unity 编译后,我复制了生成的文件夹并将其粘贴到我的 macbook 中。
You then need to call the pod install
command from that folder (by opening Terminal and navigating to the folder where your xcode is, then executing pod install
). Cocoapods will download what you need, and then you can compile.
然后您需要pod install
从该文件夹调用命令(通过打开终端并导航到您的 xcode 所在的文件夹,然后执行pod install
)。Cocoapods 会下载你需要的东西,然后你就可以编译了。
It might take 20 minutes until pod install
actually completes. To me it seamed frozen, but you can open Resource Monitor and see under the Network tab that Cocoapods indeed is downloading stuff from internet. So just give it some time.
可能需要 20 分钟才能pod install
真正完成。对我来说它被冻结了,但你可以打开资源监视器并在网络选项卡下看到 Cocoapods 确实正在从互联网下载东西。所以给它一些时间。
Then, look in the terminal for the further instructions (basically it will generate a new file, through which you must open your project from now on).
然后,在终端中查看进一步的说明(基本上它会生成一个新文件,从现在起您必须通过该文件打开您的项目)。