Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AFHTTPClient.h File Not Found

I have no idea why this is happening. I've installed AFNetworking in my project via a Podfile. Here's the current entry:

pod 'AFNetworking', '~> 1.2'

However when I call:

#import "AFHTTPClient.h"

at the top of one of my files, it says "'AFHTTPClient.h' file not found". If I open up the Pods directory, AFNetworking is in there along with AFHTTPClient.h. I have no idea what's going on. Any ideas?

like image 253
Nick ONeill Avatar asked May 05 '13 22:05

Nick ONeill


2 Answers

It can be because 'HEADER_SEARCH_PATHS doesn't have proper path to search in your added Pod(AFNetworking).

> Open xcworkspace (as after adding podfile/s it is recommended to open xcworkspace instead xcodeproj) and do the following:

  • In file Pods.xcconfig check HEADER_SEARCH_PATHS (example: ${PODS_HEADERS_SEARCH_PATHS} ) and copy it.
  • Now in 'Build Settings' of your 'app Target' add copied HEADER_SEARCH_PATHS to setting 'Header search path'

Alternative approach (Referred from iOS - Build fails with CocoaPods cannot find header files ):

  • In app target , to "User Header Search Paths" entry add following (including quotes)

    "${PODS_ROOT}/BuildHeaders"
    
  • checking 'recursive'



I hope this will solve this File not found issue.

like image 107
Alphonse R. Dsouza Avatar answered Sep 27 '22 02:09

Alphonse R. Dsouza


do you open xcworkspace? or xcodeproj? if you use CocoaPods, you always should work only with xcworkspace.

can you find other pods? try to clean the project and try again.

check whether you've done everything from this list: Creating a project that uses CocoaPods

someone had the same problem recently - can't search header path?. try to check your header search path.

like image 23
Dmitry Khryukin Avatar answered Sep 27 '22 02:09

Dmitry Khryukin