0

My problem is that I work on an old project that was fully compatible with Xcode 5, but after the update to Xcode 6 (I removed iOS 5 compatibility), I get the following error when using AFNetworking 1.0:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AFHTTPClient", referenced from:
  _OBJC_CLASS_$_HttpClient in HttpClient.o
"_OBJC_CLASS_$_AFJSONRequestOperation", referenced from:
  objc-class-ref in OperationJSON.o
"_OBJC_CLASS_$_SSKeychain", referenced from:
  objc-class-ref in AppDelegate.o
  objc-class-ref in ViewController.o
  objc-class-ref in SettingsViewController.o
  objc-class-ref in SignInViewController.o
  objc-class-ref in WebServiceManager.o
  objc-class-ref in AccountInfoViewController.o
  objc-class-ref in ChangePasswordViewController.o
  ...
"_OBJC_CLASS_$_TTTAttributedLabel", referenced from:
  objc-class-ref in PsychographicEndViewController.o
  objc-class-ref in EditVideoCategoriesViewController.o
"_OBJC_METACLASS_$_AFHTTPClient", referenced from:
  _OBJC_METACLASS_$_HttpClient in HttpClient.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I found this thread Undefined symbol for architecture "_OBJC_CLASS_$_AFHTTPClient" and I upgraded the AFNetworking to 2.0 but another error occurs :

'AFHTTPClient.h' file not found

as AFHTTPClient class is removed on the new version of AFNetworking. Also, migrating to version 2.0 is a difficult process as a lot of files must be changed.

Please suggest possible solutions, in order to use AFNetworking 1.0 with Xcode 6.

Community
  • 1
  • 1
user34977
  • 13
  • 4
  • The first errors you see is not related to AFNetworking 2.0. And you should stay at AFNetworking 1.0 if you are not ready to upgrade yet since the change between 1.0 & 2.0 is a lot. The error you see said the class is not built for i386 architectures (simulators). You should check your `Valid Architectures` section of Build Settings of the project. Then, you should check whether there is any old settings that migrated that can affect this error. Basically, if you create a project from scratch, use AFNetworking 1.0 and even target iOS 5.1, it will work fine. I just did it couple weeks ago – Peter Nov 10 '14 at 14:52
  • Thank you @Peter for your response.! I had to add arm64 at `Valid Architectures` and to set `Build Active Architecture Only` for Debug to Yes. Now it works fine.! Have a good day.! – user34977 Nov 11 '14 at 13:13
  • glad it worked out for you. Just moved my comment to answer. Appreciate it if you can accept it. – Peter Nov 11 '14 at 13:15

1 Answers1

0

The first errors you see is not related to AFNetworking 2.0. And you should stay at AFNetworking 1.0 if you are not ready to upgrade yet since the change between 1.0 & 2.0 is a lot. The error you see said the class is not built for i386 architectures (simulators). You should check your Valid Architectures section of Build Settings of the project. Then, you should check whether there is any old settings that migrated that can affect this error. Basically, if you create a project from scratch, use AFNetworking 1.0 and even target iOS 5.1, it will work fine. I just did it couple weeks ago

Peter
  • 1,109
  • 7
  • 5