问题描述
我正在尝试为 cocoapod FBSDKShareKit 重新创建绑定。
我执行了:
sharpie pod init ios FBSDKShareKit
sharpie pod bind
我得到的错误:
While building module 'FBSDKShareKit' imported from /private/var/folders/something.h:1:
In file included from <module-includes>:1:
In file included from /Users/something/ShareKit/build/Release-maccatalyst/FBSDKShareKit/FBSDKShareKit.framework/Headers/FBSDKShareKit-umbrella.h:13:
In file included from /Users/something/ShareKit/build/Release-maccatalyst/FBSDKShareKit/FBSDKShareKit.framework/Headers/FBSDKAppGroupContent.h:30:
/Users/something/ShareKit/build/Release-maccatalyst/FBSDKShareKit/FBSDKShareKit.framework/Headers/FBSDKCoreKitImport.h:29:10: Fatal error:
'FBSDKCoreKit/FBSDKCoreKit.h' file not found
#import <FBSDKCoreKit/FBSDKCoreKit.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/var/folders/something.h:1:9: Fatal error: Could not build module 'FBSDKShareKit'
@import FBSDKShareKit;
~~~~~~~^~~~~~~~~~~~~
Binding...
2 errors generated.
Error while processing /private/var/folders/something.h.
Done. Exiting with error code 1.
error: Clang Failed to parse input and exited with code 1
似乎某些参考没有正确解析/复制。 Google 没有告诉我这个问题(或者我问错了问题)。
解决方法
在 dalexsoto (Discord DotNetEvolution) 的启发下找到了一个解决方法:
-
sudo gem uninstall cocoapods && sudo gem install cocoapods -v 1.5.0
- 最新版本的 cocoapods 与最新版本的 Objective Sharpie 不兼容。
-
sharpie pod init ios FBSDKShareKit
- 只需定期下载和准备即可。
-
sharpie pod bind
(失败)- 第一次绑定尝试失败,但会创建所有必需的文件。
-
cp -r ./build/Release-maccatalyst/FBSDKCoreKit/* ./build/Release-maccatalyst/FBSDKShareKit/
- 将 FBSDKCoreKit 的构建工件复制到 FBSDKShareKit 的构建目标文件夹。这满足 Facebook sdk 头文件之间的引用。
-
sharpie pod bind
- 绑定现在按预期工作。万岁!