Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined symbols for architecture i386 when trying to compile AFNetworking 2.0

I added AFNetworking 2.0 to my project. I did it without the use CocoaPods - I just added the files to the project, making sure to copy the files to target.

When I try to compile the project I get the following error:

Undefined symbols for architecture i386:
  "_SecCertificateCopyData", referenced from:
      _AFCertificateTrustChainForServerTrust in AFSecurityPolicy.o
  "_SecCertificateCreateWithData", referenced from:
      _AFPublicKeyForCertificate in AFSecurityPolicy.o
  "_SecPolicyCreateBasicX509", referenced from:
      _AFPublicKeyForCertificate in AFSecurityPolicy.o
      _AFPublicKeyTrustChainForServerTrust in AFSecurityPolicy.o
  "_SecTrustCopyPublicKey", referenced from:
      _AFPublicKeyForCertificate in AFSecurityPolicy.o
      _AFPublicKeyTrustChainForServerTrust in AFSecurityPolicy.o
  "_SecTrustCreateWithCertificates", referenced from:
      _AFPublicKeyForCertificate in AFSecurityPolicy.o
      _AFPublicKeyTrustChainForServerTrust in AFSecurityPolicy.o
  "_SecTrustEvaluate", referenced from:
      _AFPublicKeyForCertificate in AFSecurityPolicy.o
      _AFServerTrustIsValid in AFSecurityPolicy.o
      _AFPublicKeyTrustChainForServerTrust in AFSecurityPolicy.o
  "_SecTrustGetCertificateAtIndex", referenced from:
      _AFCertificateTrustChainForServerTrust in AFSecurityPolicy.o
      _AFPublicKeyTrustChainForServerTrust in AFSecurityPolicy.o
  "_SecTrustGetCertificateCount", referenced from:
      _AFCertificateTrustChainForServerTrust in AFSecurityPolicy.o
      _AFPublicKeyTrustChainForServerTrust in AFSecurityPolicy.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is wrong with my project?

like image 402
YogevSitton Avatar asked Nov 24 '13 12:11

YogevSitton


2 Answers

Your missing iOS frameworks in the project. I bet security framework is one of them from the names I see.

like image 196
Liviu R Avatar answered Oct 10 '22 02:10

Liviu R


#import <Security/Security.h> in your PCH file + make sure the library is in "Link Binary With Libraries".

like image 42
Shai Mishali Avatar answered Oct 10 '22 04:10

Shai Mishali