0
votes

I tried to put AFNetworking 2.0 framework by usual drag and drop in iOS. Then when I execute the application it says the below errors:

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AFHTTPRequestOperation", referenced from: objc-class-ref in TableViewController.o "_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from: objc-class-ref in TableViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please let me know how to resolve this issue. I tried to use cocoapods but for some reason I couldn't install cocoapods in my machine.

3
it looks like you are using the Mac framework. iOS one is compiled with arm symbolsJeef
@jeef...AFNetworking 2.0 doesnt have separate frameworks.user4150758
Well then thats your problem :)Jeef

3 Answers

2
votes

I spent a couple of hours fighting with this exact same issue, going through all the Google hits I could find. Building for the device was working, but building for the simulator was not.

Here are the steps that finally solved the issue for me:

  1. Clear the XCode caches:

    rm -rf ~/Library/Developer/Xcode/DerivedData/
    
  2. Clear the CocoaPods caches and reinstall the dependencies:

    rm -rf "${HOME}/Library/Caches/CocoaPods"
    rm -rf "`pwd`/Pods/"
    pod update
    
  3. Finally go to the "Pods" project and set the Build Active Architectures Only to No also for the "Debug" configuration.

1
votes

I used xCode 6.1.1, download and add to project updated AFNetworking and had the same problem, but with old version AFNetworking worked good. Check this two ways, worked for me: 1) update xCode

2) download old version AFNetworking

0
votes

This kind of weird stuff started to happen after Xcode 11.4.1 update. Any library, framework that you previously had, and didn't have the symbols to be compiled to iOS simulator(x86_64) can show these errors... One solution is to recompile the framework in your machine adding the all architectures needed. I haven't recompiled AFNetworking lately, so I cannot give you a step by step on that... But probably in AFNetworking repo, they should have a makefile or configure script to that kind of thing. Good luck!