Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined symbols for architecture x86_64 AFNetworking with Cocoapods

Can anybody help me with this, its driving me crazy. I looked at every post I could find with a similar issue, and none of it worked.

I installed AFNetworking 3.0 in my project with Cocoapods, it installed, I see the AFNetworking pod in my project.Set built Architure only :YES Whenever I try to build I get the following error:

Undefined symbols for architecture x86_64:
          "_OBJC_CLASS_$_AFHTTPSessionManager", referenced from:
              objc-class-ref in EFServer.o
          "_OBJC_CLASS_$_AFJSONRequestSerializer", referenced from:
              objc-class-ref in EFServer.o
          "_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
              objc-class-ref in EFServer.o
          "_OBJC_CLASS_$_MBProgressHUD", referenced from:
              objc-class-ref in EFServer.o
        ld: symbol(s) not found for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
like image 384
kumar kumar Avatar asked Jul 05 '16 08:07

kumar kumar


3 Answers

I had the same problem after installing pods to my old project. In my case there where custom linker flags added to the Build Settings of the target, but the $(inherited) was removed so the pods flags were missing (not inherited) therefore no AFNetworking framework were linked.

I suggest to check out is there a $(inherited) row added to the Other Linker Flags section of Build Settings for the target.

like image 182
kodelit Avatar answered Oct 23 '22 00:10

kodelit


Just delete the DerivedData folder and re-try.

rm -rf ~/Library/Developer/Xcode/DerivedData

like image 20
xi.lin Avatar answered Oct 23 '22 00:10

xi.lin


add below lines to your podfile and reinstall it and add your project name to target.

target 'your project name' do
use_frameworks!
pod 'AFNetworking', '~> 3.0'
end

hope your problem will be solved.

like image 1
Amit Jagesha シ Avatar answered Oct 23 '22 00:10

Amit Jagesha シ