问题
I am using CocaPods to add AFNetowrking
and OHAttributedLabel
into my project. I installed both of the libraries. AFNetworking
is importing just fine in my project. But OHAttributedLabel
isn't. I am not sure why!
Podfile
platform :ios, '6.0'
pod 'AFNetworking'
pod 'OHAttributedLabel'
After installing both the libraries, when I import
#import "AFHTTPClient.h"
#import "AFJSONRequestOperation.h"
#import "UIImageView+AFNetworking.h"
I do not get any errors and everything works just fine
but when I am trying to import
#import <OHAttributedLabel/OHAttributedLabel.h>
#import <OHAttributedLabel/NSAttributedString+Attributes.h>
#import <OHAttributedLabel/OHASBasicMarkupParser.h>
I am getting
'OHAttributedLabel/OHAttributedLabel.h' file not found
error
pod install output
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
The suggestion says
Make sure your project is using the Pods.xcconfig. To check this select your project file, then select it in the second pane again and open the Info section in the third pane. Under configurations you should select Pods.xcconfig for each configurations requiring your installed pods.
I am not sure where to add this. This is how my configurations look like

Edit
After copying pods.xcconfig

回答1:
It looks like you are missing the proper configurations set.
You project's info should look like this

回答2:
This might sound silly, but are you trying to build and run the Pods project in your workspace rather than your own app project? I've been guilty of that many times and have seen similar errors!
回答3:
You encounter these errors when installing pods on a project that has custom compiler/linker flags like HEADER_SEARCH_PATHS and/or OTHER_LDFLAGS (via the 'Header Search Paths' or 'Other linker flags' target settings). These settings will override your pods configuration file, since configuration files have lower priority than target settings.
To fix this you will need to add $(inherited) to the HEADER_SEARCH_PATHS and other changed flags in your target build settings. Just append it to the end like this:

Also to note, when you installed the pods with pod install it should warn you with messages like this if you have set custom flags that would be affected:
[!] From now on use
myprojectname
.[!] The target
myprojectname [Debug]
overrides theOTHER_LDFLAGS
build setting defined inPods/Pods.xcconfig'. - Use the
$(inherited)` flag, or - Remove the build settings from the target.[!] The target
myprojectname [Debug]
overrides theHEADER_SEARCH_PATHS
build setting defined inPods/Pods.xcconfig'. - Use the
$(inherited)` flag, or - Remove the build settings from the target.[!] The target
myprojectname [Debug - Release]
overrides theOTHER_LDFLAGS
build setting defined inPods/Pods.xcconfig'. - Use the
$(inherited)` flag, or - Remove the build settings from the target.[!] The target
myprojectname [Debug - Release]
overrides theHEADER_SEARCH_PATHS
build setting defined inPods/Pods.xcconfig'. - Use the
$(inherited)` flag, or - Remove the build settings from the target.
回答4:
Go to your taget Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line .
来源:https://stackoverflow.com/questions/15689844/cocapods-importing-afnetworking-but-not-ohattributedlabel