尝试编译 AFNetworking 2.0 时架构 i386 的未定义符号
Posted
技术标签:
【中文标题】尝试编译 AFNetworking 2.0 时架构 i386 的未定义符号【英文标题】:Undefined symbols for architecture i386 when trying to compile AFNetworking 2.0 【发布时间】:2013-11-24 12:45:39 【问题描述】:我将 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)
我的项目有什么问题?
【问题讨论】:
【参考方案1】:您在项目中缺少的 ios 框架。 我敢打赌,从我看到的名字来看,安全框架就是其中之一。
【讨论】:
【参考方案2】:#import <Security/Security.h>
在您的 PCH 文件中 + 确保该库位于“Link Binary With Libraries”中。
【讨论】:
【参考方案3】:只需在您的项目中添加 security.framework。
【讨论】:
以上是关于尝试编译 AFNetworking 2.0 时架构 i386 的未定义符号的主要内容,如果未能解决你的问题,请参考以下文章
AFNetworking 2.0 setImageWithURLRequest
AFNetworking 2.0 AFHTTPSessionManager
AFNetworking 2.0 多部分/表单数据上传到 mySQL