APPLE MACH-O LINKED ERROR添加AFNetworking后

时间:2013-08-02 16:00:05

标签: ios afnetworking linker-errors mach-o

只需将AFNetworking添加到我的项目中,在B& R之后我就会收到如下错误:

Undefined symbols for architecture i386:
"_SecCertificateCopyData", referenced from:
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in       AFURLConnectionOperation.o
"_SecCertificateCreateWithData", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in  AFURLConnectionOperation.o
"_SecPolicyCreateBasicX509", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustCopyPublicKey", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustCreateWithCertificates", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustEvaluate", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustGetCertificateAtIndex", referenced from:
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustGetCertificateCount", referenced from:
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

已经检查过框架,libs和编译源代码,或者重新添加AFURLConnection.m,它也无法正常工作。

任何人都可以帮帮我吗? 非常感谢...

4 个答案:

答案 0 :(得分:77)

您需要添加Security.framework才能构建它。

答案 1 :(得分:16)

对我来说,我必须添加

  • Security.framework
  • SystemConfiguration.framework
  • MobileCoreServices.framework

答案 2 :(得分:0)

我有一个非常类似的问题,并且看到大约15个mach -0链接器编译器错误消息。添加安全框架可将#减少到7个错误。

进行了更多研究,发现您可能还需要通过xCode添加 SystemConfiguration.framework

这完全解决了我的问题。

作为一个FYI - 我使用的是xCode 5,目标是iOS 7并使用AFNetworking 2.0版。

添加作为答案,以防其他人发现简单地添加security.framework并不能为他们解决问题。

感谢Cody上面接受的答案。

答案 3 :(得分:0)

OS X,我不得不补充:

  • Security.framework
  • SystemConfiguration.framework