APPLE MACH-O LINKED ERROR添加AFNetworking后

只需在我的项目中添加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) 

已经检查了框架,库和编译源,或者重新添加AFURLConnection.m,它也不起作用。

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

您需要添加Security.framework才能生成。

对我来说,我必须补充

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

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

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

这完全解决了我的问题。

作为一个参考 – 我使用xCode 5,目标iOS 7和使用AFNetworking版本2.0。

添加一个答案,以防其他人发现简单地添加security.framework并不能解决这些问题。

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

OS X,我不得不补充:

  • Security.framework
  • SystemConfiguration.framework