xcode CocoaPods 未正确导入 SDK 框架

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20434203/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:23:52  来源:igfitidea点击:

CocoaPods not importing SDK frameworks properly

iosxcodeios7dropbox-apicocoapods

提问by Rameez Hussain

I have been trying to import the Dropbox-iOS-SDKinto my project through CocoaPods, but the framework file doesn't seem to be imported properly. My Podfilelooks like this:

我一直在尝试通过 将 导入Dropbox-iOS-SDK到我的项目中CocoaPods,但框架文件似乎没有正确导入。我的Podfile看起来像这样:

platform :ios, '7.0'

pod "AFNetworking", "~> 2.0"
pod 'Reachability'
pod 'Facebook-iOS-SDK', '~> 3.9'
pod "Dropbox-iOS-SDK"

I am new to CocoaPodsand I'm not sure where I am going wrong. I tried cleaning the project and restarting Xcode. But the Pods Frameworks file still looks like this:

我是新手CocoaPods,我不确定我哪里出错了。我尝试清理项目并重新启动Xcode。但是 Pods Frameworks 文件仍然是这样的:

enter image description here

在此处输入图片说明

As a result of this I am getting the following errors during build:

因此,我在构建过程中收到以下错误:

enter image description here

在此处输入图片说明

Any idea how I can fix this?

知道如何解决这个问题吗?

采纳答案by Rameez Hussain

I was adding cocoa pods to an existing project and so I had to remove references to all paths to previously imported frameworks and headers. Once I removed these, everything worked fine.

我正在向现有项目添加可可豆荚,因此我必须删除对以前导入的框架和头文件的所有路径的引用。一旦我删除了这些,一切正常。

This is in case someone runs into the same problem.

这是以防万一有人遇到同样的问题。

回答by CedricSoubrie

Same response as Rameez with more precision : As I had previously added libraries without Cocoapod, my project settings were not clean. When running pod install, the "Framework search path" and "header search path" were not set correctly.

与 Rameez 更精确的响应相同:因为我之前添加了没有 Cocoapod 的库,所以我的项目设置不干净。运行 pod install 时,“框架搜索路径”和“标头搜索路径”设置不正确。

To get the correct value for those two search path :

要获得这两个搜索路径的正确值:

  1. create an empty project
  2. add the previous podfile in the new project (just change the target name)
  3. run pod install
  4. Look at the Framework and header search path values in the new project
  5. Copy-paste those values into your previous project settings
  1. 创建一个空项目
  2. 在新项目中添加之前的podfile(只需更改目标名称)
  3. 运行 pod 安装
  4. 查看新项目中的Framework 和header 搜索路径值
  5. 将这些值复制粘贴到您之前的项目设置中

回答by rgomesbr

For me, the problem was with Other Linker Flagsand Runpath Search Paths, which weren't inheriting the settings defined on xcconfig. The following adjustments solved my problem:

对我来说,问题出在Other Linker Flagsand 上Runpath Search Paths,它没有继承 上定义的设置xcconfig。以下调整解决了我的问题:

Other Linker Flags:

其他链接器标志

$(inherited)

Runpath Search Paths:

运行路径搜索路径

$(inherited)
@executable_path/Frameworks

回答by Sagar Shinde

After pod setup successfully- Take This steps-

Pod 设置成功后 - 采取这些步骤 -

1] touch podfile

1] 触摸 podfile

2] open -e podfile

2]打开-e podfile

You will then get a text editor file. Now add your files properly. Now Save that and close that window and your Project window also. Go to Finder and you will get an proj.workspace file. Open That one.

然后您将获得一个文本编辑器文件。现在正确添加您的文件。现在保存并关闭该窗口和您的项目窗口。转到 Finder,您将获得一个 proj.workspace 文件。打开那个。

Now.......... now under xcode.proj you will find an proj.test. Go there and change deployment Target with your project name.

现在....... 现在在 xcode.proj 下你会发现一个 proj.test。去那里并使用您的项目名称更改部署目标。