2

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.

svguerin3
  • 2,433
  • 3
  • 29
  • 53
  • What's the error message? – dmcdougall Oct 26 '16 at 02:26
  • Updated with the error message. It's simply: "Error:(23, 9) 'AFNetworking/AFNetworking.h' file not found" – svguerin3 Oct 26 '16 at 02:36
  • And where is that file located on your system? And what was the compile line? If it doesn't list the directory containing those files, then you'll need to add that directory to the `-I` compiler flag (assuming C/C++ compiler) so the compiler knows where to look to find those headers. – dmcdougall Oct 26 '16 at 02:40
  • Compile line is 23, where the import is, and I have updated the question with the place in the project. Desktop/ – svguerin3 Oct 26 '16 at 02:45
  • 1
    The 'compile line' is the compiler command executed by the IDE you're using. I assume there's a way to look at this to verify the options passed to the compiler. If you're using XCode, [this](https://stackoverflow.com/questions/14134064/how-to-set-include-path-in-xcode-project) answer might be helpful. – dmcdougall Oct 26 '16 at 02:52
  • Ah sorry, I'm unfamiliar w/ the compile line. I've attached a screenshot of my "Other C Flags" settings that Pods setup. Not sure if that's helpful or not? (thank you by the way, for your help so far) – svguerin3 Oct 26 '16 at 03:06
  • So try adding your own path to the last of paths. Perhaps something like `/Users/BLAH/Desktop/BLAH2/Pods`, assuming I'm reading your screenshot correctly – dmcdougall Oct 26 '16 at 03:08
  • That was it!! Thank you! Not sure why Pods didn't do this itself, but it works now after manually adding the path. I should've tried this myself. Thank you again! – svguerin3 Oct 26 '16 at 03:25
  • You're welcome. I'll write this up in an answer so you can accept it. – dmcdougall Oct 26 '16 at 03:28
  • Absolutely will do, please do! Thanks again – svguerin3 Oct 26 '16 at 03:28

1 Answers1

0

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.

Community
  • 1
  • 1
dmcdougall
  • 2,456
  • 1
  • 17
  • 15