AFNetworking.h file not found
Solution 1
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. 2. What is placed inside /path/to/app/Pods/Headers/Public/ ?
Solution 2
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.
Solution 3
After updating pod's to (pod 'AFNetworking', '3.0') I was facing same issue.
Replacing
#import "AFNetworking.h"
With
@import AFNetworking;
solved my problem!
Baadshah
Updated on June 19, 2022Comments
-
Baadshah almost 2 years
I am using
pod 'AFNetworking', '2.6.0'
.But every time I am getting this error:
Recently I updated my mac gems. After updating gems I am getting this error.
Can you please any one help?
-
Baadshah almost 8 yearsI replaced #import "AFNetworking.h" insted of #import <AFNetworking/AFNetworking.h> but no luck.I am new for this, Can you please tell me how to check project properties
-
Vyacheslav almost 8 years@Baadshah , at first , is this the only cocoapods project you use?
-
Baadshah almost 8 yearsI am using 1.0.0 version of cocoapod.i updated the pod. use_frameworks! platform :ios, '8.0' target "TARGET" do pod 'IQKeyboardManager' pod 'HockeySDK' pod 'FPPicker', '~> 5.1.2' pod 'AFNetworking', '2.6.0' pod 'SDWebImage', '~>3.7' end But no luck
-
donjordano almost 8 yearsWhat you are open YOUR_PROJECT_NAME.xcworkspace or YOUR_PROJECT_NAME.xcodeproj ? I mean do you see your Pods project in your work space? After
pod update
do you receive any warnings ? -
Baadshah almost 8 yearsYes i am using cocoapods.
-
Jijie Chen almost 6 yearsDon't forget to choose
All
label on the header section. See this answer for a screenshot: stackoverflow.com/a/48140171/1817042