当将AFNetworking添加到工程后编译时出现

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 (use -v to see invocation)

此时需要导入3个frameworks

CFNetwork.framework
Security.framework
SystemConfiguration.framework

我在将AFNetworking 2.0添加到cocos2d的工程项目时,首席必须将与AFNetworking 2.0有关的文件都变成ARC,具体步骤

Edit-》Refactor-》Convert to Objective-c ARC...,然后将与AFNetworking 2.0有关的文件选上,继续就行

编译时还可能出现“The current deployment target does not support automated __weak references”,此时需要将__weak变成__unsafe_unretained

还可能在

@property (nonatomic, strong) dispatch_queue_t completionQueue;

出现Property with 'retain(or strong)' attribute must be of object type错误,此时将上面变成

@property (nonatomic, assign) dispatch_queue_t completionQueue;

就可以编译通过

如果感觉麻烦可以试着先创建Application的工程,然后将AFNetwork 2.0添加进去,此时编译不会报错,然后再将cocos2d添加进去

按照cocos2d中的AppDelegate修改一下AppDelegate的内容即可,此方法有待尝试

当编译AFNetworking 2.0时出现了Undefined symbols for architecture i386的更多相关文章

  1. oc调用c++接口时 报错 Undefined symbols for architecture i386:

    当在oc中调用c++中的方法时,发现说c++中的方法没定义或是找不到 Undefined symbols for architecture i386: "_desTYData", ...

  2. 添加第三方类库造成的Undefined symbols for architecture i386:编译错误

    1.原因: 如果是源码编译的话,一般就只某些头文件没有添加到src编译里面.但是对于添加库编译,一般是库的编译路径设置不正确(比如arm的版本.模拟器或者真机的不同版本库引用错误或者重复引用一起编译器 ...

  3. iOS:编译错误Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error

    Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error 这个意思为无法找到名为 ...

  4. iOS编译错误#ld: warning: ignoring file# 之 Undefined symbols for architecture x86_64 - ld: symbol(s) not found for architecture x86_64

    ld: warning: ignoring file xxxPath/libbaidumapapi.a, missing required architecture x86_64 in file xx ...

  5. Xcode编译Undefined symbols for architecture xxx 错误总结

    可能会遇到这几种错误:Undefined symbols for architecture armv7Undefined symbols for architecture armv7sUndefine ...

  6. MinGW下编译curl-7.60.0时, 发生ERROR_FILE_NOT_FOUND undeclared

    在编译curl-7.60.0时, 遇到ERROR_FILE_NOT_FOUND undeclared 这个情况, 就没法编译成功!! 下载了以往的版本, 发现是从curl-7.59.0版本开始才有 t ...

  7. ios build时,Undefined symbols for architecture xxx问题的总结

    简单来说,Undefined symbols基本上等于JAVA的ClassNotFoundException,最常见的原因有这几种: build的时候没有加framework 比如说,有一段代码我用了 ...

  8. 编译gcc5.1.0时的报错

    编译安装gcc5.1.0时出现如下报错: configure: error: error verifying int64_t uses long long 这是由于没有安装gcc_c++导致的,安装下 ...

  9. 用xcode6.3编译早期工程时出现Undefined symbols for architecture x86_64错误的解决办法(转)

    Xcode升级到5.1 新特性之一就是默认让所有App都通过64位编译器编译.原来在Xcode5.0.x的时候默认的Standard architectures只有(arm7,armv7s),到5.1 ...

随机推荐

  1. Java -- 子类使用super调用父类的方法A,A 调用了方法B,子类也override方法B,那么super.A()最终调用到了子类的B方法

    public class SuperClass{ public void printA(){ System.out.print("SuperClass-printA"); prin ...

  2. 与你相遇好幸运,Waterline的多表关联

    >一对一关联 表示一个模型可能只与另一个模型关联.为了使模型知道它与其他哪些模型关联,外键必需包含在记录中.. http://imfly.github.io/sails-docs/concept ...

  3. qsort函数详解

    C语言标准库函数 qsort 详解 文章作者:姜南(Slyar) 文章来源:Slyar Home (www.slyar.com) 转载请注明,谢谢合作. 原文链接:http://www.slyar.c ...

  4. poj 1195:Mobile phones(二维线段树,矩阵求和)

    Mobile phones Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 14391   Accepted: 6685 De ...

  5. 64位Ubuntu运行32位程序时报文件不存在(No such file or Directory)的一种解决办法

    尝试在64位Ubuntu下面运行32位程序时, 一直说 文件不存在(No such file or directory), 我只想说++. 你tm说个文件格式不正确不就好了? 非得说个文件不存在! 真 ...

  6. sqlplus使用(二)

    详见SQL*Plus® User's Guide and Reference Release 11.2   5 Using Scripts in SQL*Plus   1.定义环境变量 _EDITOR ...

  7. [LeetCode] Merge Sorted Array

    Given two sorted integer arrays A and B, merge B into A as one sorted array. Note:You may assume tha ...

  8. c++ 调用dll

    1.首先写一个dll程序并且输出成dll. 新建win32项目,然后在应用程序类型中选择dll. HelloDll.h: #pragma once #ifndef MYDLL_API_EXPORTS ...

  9. C# 遍历指定目录下的所有文件及文件夹

    // DirectoryInfo di = new DirectoryInfo(@"D:\Test"); // FindFile(di); static void FindFile ...

  10. Howto: Connect MySQL server using C program API under Linux or UNIX

    From my mailbag: How do I write a C program to connect MySQL database server? MySQL database does su ...