24

只需将 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)

已经检查过framework、libs和编译源码,或者重新添加AFURLConnection.m,也不起作用。

谁能帮帮我?多谢...

4

4 回答 4

77

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

于 2013-08-07T14:55:07.267 回答
16

对于我来说,我必须添加

  • 安全框架
  • SystemConfiguration.framework
  • MobileCoreServices.framework
于 2013-11-23T10:21:56.217 回答
0

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

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

这完全解决了我的问题。

作为一个仅供参考 - 我使用的是 xCode 5,针对 iOS 7 并使用 AFNetworking 2.0 版。

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

感谢上面的科迪接受了答案。

于 2013-11-20T12:48:00.483 回答
0

OS X,我必须添加:

  • 安全框架
  • SystemConfiguration.framework
于 2013-12-19T17:39:19.547 回答