简体   繁体   English

在旧的 xcode 项目中进行 pod 初始化后无法构建项目

[英]Unable to build Project after pod init in an old xcode project

I am trying to init pod in an old code base.我正在尝试在旧代码库中初始化 pod。 Whatever I do, I am not able to run my project after git init.无论我做什么,在 git init 之后我都无法运行我的项目。 There is always build error.总是有构建错误。 I am getting following error,我收到以下错误,

ld: warning: directory not found for option '-F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FBSDKCoreKit' ld: warning: directory not found for option '-F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FBSDKShareKit' ld: warning: directory not found for option '-F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FacebookCore' ld: warning: directory not found for option '-F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FacebookShare' ld: framework not found FBSDKCoreKit ld:警告:找不到选项'-F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FBSDKCoreKit'的目录'ld:警告:找不到选项'-的目录F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FBSDKShareKit' ld:警告:找不到选项'-F/Users/usr/Library/Developer/Xcode 的目录/DerivedData/MyApp-some_code/Build/Products/Debug-iphonesimulator/FacebookCore' ld:警告:找不到选项'-F/Users/usr/Library/Developer/Xcode/DerivedData/MyApp-some_code/Build/Products/ 的目录Debug-iphonesimulator/FacebookShare' ld:找不到框架 FBSDKCoreKit

Even if my dependency pod file is empty then I get即使我的依赖 pod 文件为空,我也会得到

pods framework not found.未找到 pod 框架。

My Framework Search Paths is set to to $(inherited), which is build/Debug-iphoneos/FBSDKCoreKit.. I have also tried to set this path to pods folder under project.我的框架搜索路径设置为 $(inherited),即 build/Debug-iphoneos/FBSDKCoreKit.. 我还尝试将此路径设置为项目下的 pods 文件夹。 But nothings works.但没有任何作用。 Even I have same issue with another project also.即使我对另一个项目也有同样的问题。 Xcode version: 12.3 Code base is in Objective C. Xcode 版本:12.3 代码库位于目标 C 中。

I have experienced a similar problem before in the past, using FacebookSDK frameworks.过去我曾使用FacebookSDK框架遇到过类似的问题。

Of course, if you were using Swift, you could easily import it with Swift Package Manager .当然,如果您使用的是 Swift,您可以使用Swift Package Manager轻松导入。

Try to perform the following steps尝试执行以下步骤

1. Edit your podfile 1. 编辑你的 podfile

Making explicit reference to the version and project name明确引用版本和项目名称

pod 'FBSDKCoreKit', ‘version’ :project_name => ‘myapp’

2. Delete build data 2.删除构建数据

MyApp-some_code being the appropriate folder name for your app MyApp-some_code是您的应用程序的适当文件夹名称

~/Library/Developer/Xcode/DerivedData/MyApp-some_code

3. Reinstall your pods 3. 重新安装你的豆荚

The command that you have probably tried a couple of times already您可能已经尝试过几次的命令

pod deintegrate
pod install

4. Manually add FBSDKCoreKit in Link Binary with Libraries 4.在Link Binary with Libraries中手动添加FBSDKCoreKit

Navigate to Project->Targets->Build Phases->Link Binary With Libraries导航到项目->目标->构建阶段->将二进制文件与库链接

From there click on the plus button and manually add the FBSDKCoreKit framework从那里单击加号按钮并手动添加FBSDKCoreKit框架

5. Deselect copy items to destination's group folder 5.取消选择复制项目到目的地的组文件夹

As per Facebook official documentation, availablehere .根据 Facebook 官方文档,可在此处获得。 Check out the point number 3, in particular.尤其要查看第 3 点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM