【问题标题】:APPLE MACH-O LINKED ERROR After adding AFNetworkingAPPLE MACH-O LINKED ERROR 添加 AFNetworking 后
【发布时间】:2013-08-02 16:00:04
【问题描述】:

只是将 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,也不行。

谁能帮帮我? 非常感谢...

【问题讨论】:

  • 您确定添加了 Security.framework 吗?
  • 成功,非常感谢。@MartinR 然而奇怪的是,在没有 Security.framework 的示例演示中,它可以正常运行。只是在我自己的项目中出现了这个错误。

标签: ios afnetworking linker-errors mach-o


【解决方案1】:

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

【讨论】:

  • 谢谢。我还需要添加示例项目中的所有框架。
【解决方案2】:

对于我来说,我必须添加

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

【讨论】:

  • 这种组合对我有用,而仅仅添加“Security.framework”是行不通的。 AFNetworking 需要说明这一点,它非常缺乏好的文档。
【解决方案3】:

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

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

这完全解决了我的问题。

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

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

感谢上面的 Cody 接受的答案。

【讨论】:

    【解决方案4】:

    OS X,我必须补充:

    • Security.framework
    • SystemConfiguration.framework

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-05
      • 2013-02-12
      • 1970-01-01
      • 2018-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多