Undefined symbols for architecture arm64解决方案
在iOS开发中经常遇到的一个错误是Undefined symbols for architecture arm64,这个错误表示工程某些地方不支持arm64指令集。那我们应该怎么解决这个问题了?我们不仅要解决这个问题,更要了解出现这个问题的根源.这样根本上杜绝这类问题发生.
对于iOS设备来说iOS的指令集有armv6、armv7、armv7s、arm64这样四种,不同型号的iOS设备使用不同的指令集,下面是各自的区别:
armv6- iPhone、iPhone 3G
- iPod 1G、iPod 2G
armv7- iPhone 3GS、iPhone 4
- iPod 3G、iPod 4G、iPod 5G
- iPad、iPad 2、iPad 3、iPad Mini
armv7s- iPhone 5、iPhone 5C
- iPad 4
arm64- iPhone 5S iPhone 6 iPhone 6Plus
- iPad Air, Retina iPad Mini
在Xcode的target->Build Settings中有一个Architectures的分组主要是用来设置Architectures方面的内容,下面重点介绍下面几个设置项的内容。
Architectures
该编译选项指定了工程将被编译成支持哪些指令集,支持指令集是通过编译生成对应的二进制数据包实现的,如果支持的指令集数目有多个,就会编译出包含多个指令集代码的数据包,造成最终编译的包很大。
官方文档说明:
Space-separated list of identifiers. Specifies the architectures (ABIs, processor models) to which the binary is targeted. When this build setting specifies more than one architecture, the generated binary may contain object code for each of the specified architectures.
Build Active Architectures Only
该编译项用于设置是否只编译当前使用的设备对应的arm指令集。
当该选项设置成YES时,你连上一个armv7指令集的设备,就算你的Valid Architectures和Architectures都设置成armv7/armv7s/arm64,还是依然只会生成一个armv7指令集的二进制包。
当然该选项起作用的前提是你的Xcode必须成功连接了调试设备。如果你没有任何活跃设备,即Xcode没有成功连接调试设备,就算该设置项设置成YES依然还会编译Valid Architectures和Architectures指定的二进制包。
通常情况下,该编译选项在Debug模式都设成YES,Release模式都设成NO。
官方文档说明:
Boolean value. Specifies whether the product includes only object code for the native architecture.
Valid Architectures
该编译项指定可能支持的指令集,该列表和Architectures列表的交集,将是Xcode最终生成二进制包所支持的指令集。
比如将Valid Architectures设置支持的arm指令集版本有:armv7、armv7s、arm64,对应的Architectures设置的支持arm指令集版本有:armv7s,这时Xcode只会生成一个armv7s指令集的二进制包。
官方文档说明:
Space-separated list of identifiers. Specifies the architectures for which the binary may be built. During the build, this list is intersected with the value of ARCHS build setting; the resulting list specifies the architectures the binary can run on. If the resulting architecture list is empty, the target generates no binary.
说明
1、指令集是向下兼容的。比如,armv7s指令集的设备,可以兼容运行使用armv7、armv6编译的程序。
示例
在做项目的时候,用到了第三方社交分享静态库是时候,会编译失败,先来看看下图
看,它忽略了那个静态库文件导致链接失败了,然后我查看了静态库所支持的架构,打开终端输入查看命令lipo - info xxx.a ,结果如下:
发现了这个静态库只支持armv7 armv7s i386 . 而在我的工程中Valid Architectures和Architectures中均包含了arm64的指令集,这就是说明我需要编译的app最终要支持arm64的,而程序中用到的静态库并没有arm64,所以才导致了出错,因此,需要我们去重新下载一个支持arm64的静态库文件,那么就可以正常编译通过了.
参考文档
1、《Xcode设置项之Architectures和Valid Architectures》
3、《64-Bit Transition Guide for Cocoa Touch》
Undefined symbols for architecture arm64解决方案的更多相关文章
- Undefined symbols for architecture arm64: "_OBJC_CLASS_$_WKWebView", referenced from: objc-c
出现: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_WKWebView", referenced from: ...
- ios集成极光推送:Undefined symbols for architecture arm64: "_dns_parse_resource_record", referenced from:?
添加libresolv.tbd库,即可解决问题 Undefined symbols for architecture arm64: "_dns_parse_resource_record&q ...
- Undefined symbols for architecture arm64: "_OBJC_CLASS_$XXX", referenced from: objc-class-ref in XXX
ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 ...
- iOS Undefined symbols for architecture arm64解决办法
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_YYCache", referenced from: ...
- Undefined symbols for architecture arm64:问题
Undefined symbols for architecture arm64: "_sqlite3_prepare_v2", referenced from: +[HMJSch ...
- iOS开发遇到的坑之一: 开发遇见如下错误:Undefined symbols for architecture arm64
博客处女作,写得不好望谅解! “for architecture arm64”就是说没有支持arm64,在Build settings里architecture相关的几项需要配置正确 在最近升级coc ...
- 解决xcode5升级后,Undefined symbols for architecture arm64:问题
The issue is that the cocoapods have not been built for arm64 architecture yet thus they cannot be l ...
- Undefined symbols for architecture arm64:
1. 没有往项目中导入静态库(.a 文件)需要的 framework. 2.拖到项目中的静态库不支持arm64(或其他)指令集 这种情况没遇到过 一般都是第一种情况.
- Undefined symbols for architecture arm64(其cpu架构)
"_OBJC_CLASS_$_XXX",referenced from: 之类的问题,很多人看到这些很头疼,不知道从何下手去修改.以下是我总结的相关修改办法.如下图 这是一个很明显 ...
随机推荐
- ABP源码分析三十七:ABP.Web.Api Script Proxy API
ABP提供Script Proxy WebApi为所有的Dynamic WebApi生成访问这些WebApi的JQuery代理,AngularJs代理以及TypeScriptor代理.这些个代理就是j ...
- WCF学习之旅—WCF中传统的异常处理(十六)
WCF中的异常处理 在软件开发过程中,不可能没有异常的出现,所以在开发过程中,对不可预知的异常进行解决时,异常处理显得尤为重要.对于一般的.NET系统来说,我们简单地借助try/catch可以很容易地 ...
- javascript中字符串的比较规则
弄清这个还是很重要的,在字符排序中很有用处 非空字符串 > 空字符串 从第一个字符的charCode开始比较,大的就大 所有的字符都相同,就比较长度,长的大 '0'>'' '2'>' ...
- 【Win 10 应用开发】加载外部的 srt 字幕
据说系统内置的多媒体功能支持 srt. ssa 等字幕,老周测试过几种格式的字幕均能加载. SRT 字幕是最简单的字幕结构,甚至你用记事本都能做出来,就是分为几行来写. 第一行是字幕的编号,应该是从1 ...
- Android消息传递之EventBus 3.0使用详解
前言: 前面两篇不仅学习了子线程与UI主线程之间的通信方式,也学习了如何实现组件之间通信,基于前面的知识我们今天来分析一下EventBus是如何管理事件总线的,EventBus到底是不是最佳方案?学习 ...
- CentOS7安装iptables防火墙
CentOS7默认的防火墙不是iptables,而是firewalle. 安装iptable iptable-service #先检查是否安装了iptables service iptables st ...
- git for windows 的默认工作路径(HOME)的设置以及Git与GitHub之间的SSH加密协议
1.安装及配置默认路径 Windows中从GitHub上面:https://git-for-windows.github.io/ 下载安装好git后(双击,改一下需要的安装路径,一路确定就好了),安装 ...
- 前端MVC学习总结(二)——AngularJS验证、过滤器、指令
一.验证 angularJS中提供了许多的验证指令,可以轻松的实现验证,只需要在表单元素上添加相应的ng属性,常见的如下所示: <input Type="text" ng-m ...
- 你真的会玩SQL吗?玩爆你的数据报表之存储过程编写(上)
你真的会玩SQL吗?系列目录 你真的会玩SQL吗?之逻辑查询处理阶段 你真的会玩SQL吗?和平大使 内连接.外连接 你真的会玩SQL吗?三范式.数据完整性 你真的会玩SQL吗?查询指定节点及其所有父节 ...
- electron之Windows下使用 html js css 开发桌面应用程序
1.atom/electron github: https://github.com/atom/electron 中文文档: https://github.com/atom/electron/tree ...