Search code examples
iosobjective-ccocoa-touchafnetworking-2

Issue while integrating with AFNetworking


I am facing an issue while integrating with AFNetworking (for the first time). I needed to support iOS 6 so I downloaded AFNetworking 2.5.4 framework.

After downloading, I dragged and dropped AFNetworking folder into my project, choose the right targets and selected the option Copy items if needed.

Then in one of my implementation file, I started typing import statement and Xcode showed me all AFNetworking related files and I selected AFNetworking.h to add #import "AFNetworking.h" statement.

But, to my surprise, I am getting following compilation error saying AFNetworking.h file not found.

Any idea what am I missing here?

PS: 1. I do not want to go via Submodule git or Cocoa Pods way. 2. Tried by cleaning the project and re-build. 3. Tried by importing the module - @import AFNetworking.

enter image description here

Here is how it looks when I add the AFNetworking folder:

enter image description here


Solution

  • It appears the files you have dragged over (as a complete folder) have not all been mapped with Xcode.

    A fix (though there will be quicker solutions than this), is that you manually create your folders in your project matching the folder names within the AFNetworking folders, and drag the actual group of class files into each of your own folders. (delete the initially aded blue folder first.)

    Although it's a pain, and realise not the quickest solution, though in the meantime this will fix it. I hope this helps

    Jim