Xcode的Architectures和Valid Architectures的区别,

登录 | 注册

ys410900345的专栏

目录视图摘要视图订阅

学院APP首次下载,可得50C币!     欢迎来帮助开源“进步”     当讲师?爱学习?投票攒课吧     CSDN 2015博客之星评选结果公布

关闭

2014-05-14 11:23 651人阅读 评论(0) 收藏 举报

分类: ios 开发(70)

目录(?)[+]

发表于6个月前(2013-10-29 21:07)   阅读(1085) | 评论(1) 2人收藏此文章, 我要收藏

赞1

Architectures Valid Architectures including 64-bit armv7 arm64

目录[-]

Xcode的Architectures和Valid Architectures的区别

Architectures

Valid Architectures

原因解释如下:

参考1:

所有IOS设备详情列表 List of iOS devices - Wikipedia, the free encyclopedia

参考2:

iOS 7: 如何为iPhone 5S编译64位应用。

参考3:

What‘s the difference between “Architectures” and “Valid Architectures” in Xcode Build Settings?

参考4:

Xcode 5 and iOS 7: Architecture and Valid architectures

参考5:

how to stop xcode5.1 building for 64bit

参考6:

1. Xcode Build Setting Reference (苹果官方文档)

2. 64-Bit transition Guide for Cocoa Touch (苹果官方文档)

作者:shede333

主页:http://my.oschina.net/shede333

版权声明:原创文章,版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0

Xcode的Architectures和Valid Architectures的区别

Architectures

这代表,在这个项目里你想要Xcode编译的目标设备列表。

Valid Architectures

还不是太明确这个设置的意图,但是一般来说是不需要更改的。

在Xcode5.0里的Valid Architectures 设置里,有2个选项:

默认为standard architectures (including 64-bit)(armv7,armv7s,arm64),这样设置,你的Deployment target最低只能设置为 6.0,(在Xcode5.0.1 之后,最低能够兼容IOS 5.1.1);

standard architectures (armv7,armv7s),这样设置,你的Deployment target最低能设置为 4.3;

原因解释如下:

使用standard architectures (including 64-bit)(armv7,armv7s,arm64)参数,

则打的包里面有32位、64位两份代码,

在iPhone5s(iPhone5s的cpu是64位的)下,会首选运行64位代码包,

其余的iPhone(其余iPhone都是32位的,iPhone5c也是32位),

只能运行32位包,

但是包含两种架构的代码包,只有运行在ios6,ios7系统上。

这也就是说,这种打包方式,对手机几乎没啥要求,但是对系统有要求,即ios6以上。

而使用standard architectures (armv7,armv7s)参数,

则打的包里只有32位代码,

iPhone5s的cpu是64位,但是可以兼容32位代码,即可以运行32位代码。但是这会降低iPhone5s的性能,原因下面的参考有解释。

其余的iPhone对32位代码包更没问题,

而32位代码包,对系统也几乎也没什么限制。

所以总结如下:

要发挥iPhone5s的64位性能,就要包含64位包,那么系统最低要求为ios6。

如果要兼容ios5以及更低的系统,只能打32位的包,系统都能通用,但是会丧失iPhone5s的性能。

参考1:

所有IOS设备详情列表 List of iOS devices - Wikipedia, the free encyclopedia

armv6:iPhone 2G/3G,iPod 1G/2G

armv7:iPhone 3GS/4/4s,iPod 3G/4G,iPad 1G/2G/3G ,iPad Mini 1

armv7s:iPhone5 ,iPhone5C ,iPad4

armv8:iPhone5S ,iPad5(iPad Air), iPad Mini 2(iPad Mini Retina)

参考2:

iOS 7: 如何为iPhone 5S编译64位应用。

Xcode 5编译的iOS 7程序包含了32位和64位两套二进制代码,在32位的iOS系统上会调用32位的二进制代码,在64位系统上会调用64位的二进制代码,以此来解决向后兼容的问题。

同时,考虑到很多32位的程序可能在没有重新编译的情况下部署到64位系统上,64位的iOS系统中带有两套FrameWork,一套是32位的,一套是64位的。

当64位的iOS系统运行原来的32位程序时,系统会调用32位的FrameWork作为底层支撑,当系统运行64位程序时,系统会调用64位的FrameWork作为底层支撑。

也就是说,当一个iPhone 5S上同时运行32位程序和64位程序时,系统同时将32位和64位两套FrameWork载入了内存中,所以消耗的内存也比较多。

如果一台64位的iOS设备上运行的所有程序都是为64位系统编译过的,iOS系统将只载入64位的FrameWork,这将节省好多内存。所以,如果大家都可以快速将程序传换成64位的,iOS将跑得更快。真的是“大家好才是真的好”。

参考3:

What‘s the difference between “Architectures” and “Valid Architectures” in Xcode Build Settings?

Architectures are the ones you want to build, valid architectures are the ones you could conceive of building with your codebase.

So maybe you only want to build your binary for armv7s, but the same source code would compile fine for armv7 and armv6. So VALID_ARCHS = armv6 armv7 armv7s, but you set ARCHS = armv7s because that‘s all you actually want to build with your code.

Or, in Apple-ese:

ARCHS (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.

and:

VALID_ARCHS (Valid Architectures)

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.

Source: Xcode Build Setting Reference

In practice, you leave VALID_ARCHS alone and don‘t worry about changing it, and just fiddle withARCHS to set the architectures you want to build. Typically, you set a Debug build to just NATIVE_ARCH, since you only want to build the debug version for the machine you‘ll be testing/running it on, and Release builds for the full spectrum of architectures you plan to support.

参考4:

Xcode 5 and iOS 7: Architecture and Valid architectures

Set the architecture in build setting to Standard architectures(armv7,armv7s)

enter image description here

iPhone 5S is powered by A7 64bit processor. From apple docs

Xcode can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 7 or later.

Note: A future version of Xcode will let you create a single app that supports the 32-bit runtime on iOS 6 and later, and that supports the 64-bit runtime on iOS 7.

From the documentation what i understood is

Xcode can create both 64bit 32bit binaries for a single app but the

deployment target should be iOS7. They are saying in future it will

be iOS 6.0

32 bit binary will work fine in iPhone 5S(64 bit processor).

Update (Xcode 5.0.1)

In Xcode 5.0.1 they added the support to create 64 bit binary for iOS 5.1.1 onwards.

Xcode 5.0.1 can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 5.1.1 or later. The 64-bit binary runs only on 64-bit devices running iOS 7.0.3 and later.

Update (Xcode 5.1)

Xcode 5.1 made significant change in the architecture section. This answer will be a followup for you.

Check this

参考5:

how to stop xcode5.1 building for 64bit

OP is posted the solution along with the question itself. But I feel it would be better to add it as an answer. In Xcode 5.1 apple made significant changes to the architecture section. They made arm64 as part of Standard architectures. That means the projects using the default setting will be automatically build for arm64 also. So what you will do if your app does not support arm64?.

Doc says:

Projects not able to support 64-bit need to specifically set the architectures build setting to not include 64-bit.

How to do that?

Goto Targets–>Build Settings–>Architectures–>Architectures

Double click on the architecture will popup a menu. Choose others

enter image description here

Delete the existing row - $(ARCH_STANDARD). Add the required architectures one by one

enter image description here

Now your architecture section will look like this

enter image description here

CGRectInset CGRectoffset UIEdgeInsetsInsetRect 这三个函数的使用情况(1)

关于UISearchDisplayController的一些使用经验分享(1)

时间: 2024-12-17 09:20:35

Xcode的Architectures和Valid Architectures的区别,的相关文章

Xcode的Architectures、Valid Architectures和Build Active Architecture Only属性(原创)

最近xcode升级了5.1版本,升级之后程序报关于要适配arm64机器的错.之前对xcode的参数配置,一直不是很了解,但实现先面对问题了,就调查了一下并解决它. 一个一个来吧. Architectures 这代表,在这个项目里你想要Xcode编译的目标设备列表.Valid Architectures 还不是太明确这个设置的意图,但是一般来说是不需要更改的,和Architectures一样就可以. 在Xcode5.1里的Valid Architectures 设置里,默认为Standard ar

xcode5时代如何设置Architectures和Valid Architectures

目前ios的指令集有以下几种: 1,armv6,支持的机器iPhone,iPhone2,iPhone3G及对应的iTouch 2,armv7,支持的机器iPhone4,iPhone4S 3,armv7s,支持的机器iPhone5,iPhone5C 4,arm64,支持的机器:iPhone5S 机器对指令集的支持是向下兼容的,因此armv7的指令集是可以运行在iphone5S的,只是效率没那么高而已~ ======================== Architecture : 指你想支持的指令

Xcode设置项之Architectures和Valid Architectures

iPhone指令集 本文所讲的内容都是围绕iPhone的CPU指令集(想了解ARM指令集的同学请点击这里),现在先说说不同型号的iPhone都使用的是什么指令集: ARMv8/ARM64 = iPhone 5s, iPad Air, Retina iPad Mini ARMv7s = iPhone 5, iPhone 5c, iPad 4 ARMv7  = iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, 

Xcode 中armv6 armv7 armv7s arm64 i386 x86_64 归纳 (Architectures, Valid Architectures, Build Active Architecture Only)

http://www.jianshu.com/p/09b445300d40 简介: armv7|armv7s|arm64都是ARM处理器的指令集 i386|x86_64 是Mac处理器的指令集 目前iOS的ARM处理器指令集及其支持的设备: armv6 (基本消失了) iPhone iPhone2 iPhone3G iPod Touch1, 2 armv7 (4s最高支持到iOS9, 从iOS10开始支持的也可以不考虑这个了) iPhone 3GS iPhone4 iPhone4S iPad,

IOS Xcode开发中的文件后缀名区别m,mm,cpp,h

.h :头文件.头文件包含类,类型,函数和常数的声明. .m :源代码文件.这是典型的源代码文件扩展名,可以包含Objective-C和C代码. .mm :源代码文件.带有这种扩展名的源代码文件,除了可以包含Objective-C和C代码以外还可以包含C++代码.仅在你的Objective-C代码中确实需要使用C++类或者特性的时候才用这种扩展名 .cpp:只能编译C++ 当你需要在源代码中包含头文件的时候,你可以使用标准的#include编译选项,但是Objective-C提供了更好的方法.#

Xcode中的Version和Build的区别

Version( 应用程序发布版本号 ) Version对应的是CFBundleShortVersionString. Version 一般由产品部门确定,版本号是由分隔的整数组成的字符串,一般有2段或者3段式, 如:1.2,  1.2.3 二段式: 第一个段:(主版本号)大功能的新增或者有迥异的变化 第二个段:(副版本号)既包含小功能更新也会包含 bug 修复 三段式: 第一个段:重大修改的版本,如实现新的大功能或重大变化的修订. 第二个段:实现较突出的特点,如新功能添加和大问题修复. 第三个

xcode工程编译错误:No architectures to compile for

问题 开发环境:xcode6,iPhone6模拟器 xcode工程编译错误:No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386). 原因 导致这个错误的原因主要是CPU的编译架构引起的,Build Active Architecture Only属性设置为了YES(只编译当前模拟器指令集),当出现不兼容设备时就会出现错误. 解决 在工程Build Settings,

iOS之关于Architectures设置及Build Active Architecture Only编译设置

一,前言 最近在帮朋友解决极光报错的提示:"file was built for archive which is not the architecture being linked (i386)"时,涉及到Build Active Architecture Only设置问题.所以又重新温习了一下,以便查询. 二,关于Architectures 浅谈  iOS项目打包,或者只是在项目里面调用第三方静态库抑或是自己新建一个静态库,就要无可避免的和Architectures打交道. * 什

Xcode编辑器的Valid Architecture

今天为大家讲解的是 Xcode编辑器的Valid Architecture参数的意思,字面翻译:有效的架构(即CPU架构). Xcode是苹果公司向开发人员提供的集成开发环境(非开源),用于开发Mac OS X,iOS的应用程序.其运行于苹果公司的Mac操作系统下. iOS的App现在基本都是用llvm在编译,Xcode也提供了各种设置帮助你进行编译参数的设定.里面有一项就是设定编译的体系结构,涉及到的参数包 括:Architectures.Valid Architectures和Build A