CocaPods导入AFNetworking但不导入OHAttributedLabel

我正在使用CocaPods将AFNetowrkingOHAttributedLabel添加到我的项目中。 我安装了两个库。 AFNetworking在我的项目中导入得很好。 但OHAttributedLabel不是。 我不知道为什么!

Podfile

 platform :ios, '6.0' pod 'AFNetworking' pod 'OHAttributedLabel' 

安装两个库后,导入时

 #import "AFHTTPClient.h" #import "AFJSONRequestOperation.h" #import "UIImageView+AFNetworking.h" 

我没有得到任何错误,一切正常

但是当我试图导入时

 #import  #import  #import  

我正进入(状态

'OHAttributedLabel/OHAttributedLabel.h' file not found

错误

pod安装输出

 Resolving dependencies of `./Podfile' Updating spec repositories Cocoapods 0.17.0.rc7 is available. Resolving dependencies for target `default' (iOS 6.0) Downloading dependencies Using AFNetworking (1.1.0) Installing OHAttributedLabel (3.4.1) Generating support files 

建议说

确保您的项目使用Pods.xcconfig。 要选中此项,请选择项目文件,然后再次在第二个窗格中选择它,并在第三个窗格中打开“信息”部分。 在配置下,您应该为需要安装的pod的每个配置选择Pods.xcconfig。

我不知道在哪里添加这个。 这就是我的配置的样子

在此处输入图像描述

编辑

复制pods.xcconfig后

在此处输入图像描述

看起来你错过了正确的配置集。

你的项目信息应该是这样的

在此处输入图像描述

这可能听起来很愚蠢,但您是在尝试在工作区中构建和运行Pods项目而不是您自己的应用程序项目吗? 我已经多次犯了罪,并且看到过类似的错误!

在具有自定义编译器/链接器标志(如HEADER_SEARCH_PATHS和/或OTHER_LDFLAGS)(通过“标头搜索路径”或“其他链接器标志”目标设置)的项目上安装pod时,会遇到这些错误。 这些设置将覆盖您的pod配置文件,因为配置文件的优先级低于目标设置。

要解决此问题,您需要将$(inheritance)添加到目标构建设置中的HEADER_SEARCH_PATHS和其他已更改标志。 只需将它附加到最后: 修改构建设置

另外需要注意的是,当你安装pod安装pod时,如果你设置了受影响的自定义标志,它应该用这样的消息警告你:

[!]从现在开始使用myprojectname

[!]目标myprojectname [Debug]会覆盖Pods/Pods.xcconfig'. - Use the定义的OTHER_LDFLAGS构建设置Pods/Pods.xcconfig'. - Use the Pods/Pods.xcconfig'. - Use the $(inheritance)`标志,或 – 从目标中删除构建设置。

[!]目标myprojectname [Debug]会覆盖Pods/Pods.xcconfig'. - Use the定义的HEADER_SEARCH_PATHS构建设置Pods/Pods.xcconfig'. - Use the Pods/Pods.xcconfig'. - Use the $(inheritance)`标志,或 – 从目标中删除构建设置。

[!]目标myprojectname [Debug - Release]会覆盖Pods/Pods.xcconfig'. - Use the定义的OTHER_LDFLAGS构建设置Pods/Pods.xcconfig'. - Use the Pods/Pods.xcconfig'. - Use the $(inheritance)`标志,或 – 从目标中删除构建设置。

[!]目标myprojectname [Debug - Release]会覆盖Pods/Pods.xcconfig'. - Use the定义的HEADER_SEARCH_PATHS构建设置Pods/Pods.xcconfig'. - Use the Pods/Pods.xcconfig'. - Use the $(inheritance)`标志,或 – 从目标中删除构建设置。

转到您的taget构建设置 – >其他链接器标志 – >双击。 将$(inheritance)添加到新行。