尝试编译AFNetworking 2.0时,架构i386的未定义符号

时间:2013-11-24 12:45:40

标签: xcode linker afnetworking afnetworking-2 i386

我在项目中添加了AFNetworking 2.0。 我没有使用CocoaPods就做到了 - 我只是将文件添加到项目中,确保将文件复制到目标。

当我尝试编译项目时,我收到以下错误:

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)

我的项目出了什么问题?

3 个答案:

答案 0 :(得分:16)

项目中缺少的iOS框架。 我打赌安全框架就是我看到的名字之一。

答案 1 :(得分:5)

PCH文件中的

#import <Security/Security.h> +确保库位于“Link Binary With Libraries”中。

答案 2 :(得分:0)

只需在项目中添加security.framework即可。