Baadshah
Baadshah

Reputation: 71

AFNetworking.h file not found

I am using pod 'AFNetworking', '2.6.0'.

But every time I am getting this error:

enter image description here

Recently I updated my mac gems. After updating gems I am getting this error.

Can you please any one help?

Upvotes: 7

Views: 21929

Answers (5)

Marcel Hofgesang
Marcel Hofgesang

Reputation: 1040

The issue was that I couldn't build and got the error message 'AFCompatibilityMacros.h' file not found

Simply running pod deintegrate and then pod install fixed it. I found the solution in this discussion.

Upvotes: 1

Muhammad Usman
Muhammad Usman

Reputation: 69

After updating pod's to (pod 'AFNetworking', '3.0') I was facing same issue.

Replacing

#import "AFNetworking.h"

With

@import AFNetworking;

solved my problem!

Upvotes: 2

Artem
Artem

Reputation: 401

enter image description here

Next steps always help me to fix the issue:

  1. Select Pods file in your project.
  2. Open the Build settings for Pods project
  3. Set Build Active Architecture Only to false. Build and Run the project again.

Upvotes: 2

Vyacheslav
Vyacheslav

Reputation: 27211

Try

#import "AFNetworking.h"

instead of

#import <AFNetworking/AFNetworking.h>

And, of course, do not forget to check the header paths inside your project properties and check if cocoapods correctly installed 'AFNetworking' project. Try to find AFNetworking.h file inside 'pods' directory.

EDIT Type, what is writen inside 'header search path' 1. enter image description here 2. What is placed inside /path/to/app/Pods/Headers/Public/ ?

Upvotes: 7

donjordano
donjordano

Reputation: 346

If you have updated your gems, check version of cocoapods if is version 1.0.0, probably you need to change your Podfile.

ex:

platform :ios, 'IOS_VERSION_HERE'
target 'YOUR_TARGET_HERE' do
    pod 'AFNetworking', '2.6.0'
    pod ...
    pod ..
end

After that in terminal go to you project folder where is the Podfile located and write command:

pod update

After that if you see some warnings try to fix them. The warnings will guide you what to do if is necessary. Then try to clean your project and Build it again.

IMPORTANT!!!

When you use Pod's you must open YOUR_PROJECT_NAME.xcworkspace instead of YOUR_PROJECT_NAME.xcodeproj

Hope this help.

Upvotes: 3

Related Questions