svguerin3 svguerin3 - 1 year ago 200
iOS Question

AFNetworking files cannot be found

I have a project that is a couple years old, it uses Pods to utilize AFNetworking 1.3.3 (it was using RestKit, but I changed over to AFNetworking and still am having the same issues).

My import statements cause a compile failure

#import <AFNetworking/AFNetworking.h> // fail
#import <AFNetworking/AFHTTPClient.h> // fail

The error is simply:

Error:(23, 9) 'AFNetworking/AFNetworking.h' file not found

(or AFNetworking/AFHTTPClient.h if I try to import that one)

I can open the Pods folder in the project and clearly see the files there. I can even drill down into the classes, and my AppCode IDE auto-fills them in and/or auto imports them. But the project simply won't compile, as it does not recognize the imports above. See for reference, the files are there:

enter image description here

I've tried changing around versions of the framework with no luck. Any thoughts on something I may be overlooking? This project used to compile fine under older versions of Xcode, and nothing has changed with regards to the framework being used or the code using it.

Here is what my "Other C Flags" in build settings looks like with regards to what Pods setup:

enter image description here

Thank you in advance! Please let me know if there is more info I can provide.

Answer Source

It appears your IDE's list of include paths to search doesn't contain the directory of your AFNetworking headers.

Adding /Users/$USER/Desktop/blah/Pods to the list of "Other C Flags", much like in this answer for XCode, should solve your problem.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download