当前位置: 移动技术网 > IT编程>移动开发>IOS > 详解Xcode编译选项功能

详解Xcode编译选项功能

2019年07月24日  | 移动技术网IT编程  | 我要评论

电视机排名,招聘狗,长江铝锭价格

以下所有编译选项都基于xcode 4.6。本文基于apple xcode文档、《professional xcode 3》、以及google搜索结果翻译而成。我对于编译认识较浅。如有解释不当的地方请谅解。在某些翻译可能会不恰当的地方,都附上了英文原文。

architectures 架构

additional sdks

在编译的时候需要附加的sdk。

architectures

支持的处理器架构。不同的处理器对应不同版本的iphone。

其中支持armv6的设备为:

* iphone1

* iphone3g

* ipod touch 1

* ipod touch 2

支持armv7的设备为:

* iphone 3gs

* iphone 4

*ipad

* the new ipad

* ipod touch 3g

* ipod touch 4

支持armv7s的设备为:

* iphone5

iphone对于指令集是向下兼容的。高版本的iphone可以运行低版本的指令集。因此要适应全系列的iphone,architectures应选择armv6。

base sdk

这决定了你的app所能支持的ios最高版本。如果你选择了ios6.1,则你的app只能被ios 6.1.x以下的系统安装。xcode默认设置为能够支持的最新版本。

build active architecture only

如果此项为yes,则在xcode会根据设备的版本只将相应的architecture编译入app。如连接了iphone4进行编译,build active architecture only为yes,则编译时只会构建armv7的二进制文件。若连接的是iphone5,则构建出armv7s的二进制文件。

这个选项在debug时默认为yes,在release时默认为no。这使得debug时编译的时间比release快,更加方便调试。

supported platforms

app所支持的平台,有ios和osx两个选项。

valid architectures

app预期将要应用到的架构。默认与architectures的值相同。这个选项让你可以在编译的时候只打包armv7s架构,但是兼容armv6,armv7。

build locations

build products path

产品文件和编译中间文件的根目录。产品文件和编译时临时文件都将放在这个目录的子目录中。

intermediate build files path

编译时临时文件的存放位置。编译中间文件格式为product name+.build,如myproduct.build。

per-configuration build product path

directory path. identifies the directory that holds temporary files for the active build configuration.

当前编译设置下的产品存放位置。

per-configuration intermediate file path

directory path. identifies the directory that holds temporary files for the active build configuration.

当前编译设置下编译时临时文件的存放位置。

precompiled headers cache path

directory path. specifies the directory in which to place precompiled headers. targets can share precompiled headers by specifying the same value for this build setting.

存放预编译头文件的位置。通过这个配置,targets可以互相共享预编译的头文件。

build options

build variants

space-separated list of identifiers. specifies the binary variants of the product. you can create additional variant names for special purposes. for example, you can use the name of a build configuration as a variant name to create highly customized binaries.

values:

normal: use to produce a normal binary.

profile: use to produce a binary that generates profile information.

debug: use to produce a binary with debug symbols, additional assertions, and diagnostic code.

此项可以设定生成产品的变种。您可以创建额外的产品变种作为特殊用途。例如,您可以使用编译配置文件的名称来创建一个高度定制的二进制文件。

build variants的值有三个:

normal-用于生成普通的二进制文件

profile-用于可以生成配置信息的二进制文件

debug-用于生成带有debug标志、额外断言和诊断代码的二进制文件

compiler for c/c++/object-c

选择使用的编译器。xcode自带有两种选项,apple llvm和llvm gcc。建议使用默认选项---apple llvm。

debug information format

这个选项决定了记录debug信息的文件格式。选项有dwarf with dsym file和dwarf。建议选择dwarf with dsym file。dwarf是较老的文件格式,会在编译时将debug信息写在执行文件中。

generate profiling code

是否生成配置代码。默认选择no。

precompiled header uses files from build directory

预编译build路径中的头文件。由于编译过程比较耗时,且两次编译之间未必会改动所有文件。因此将不会改动的常用文件保留成预编译文件将大大减少编译时的时间。建议这一项选择yes。

run static analyzer

运行静态分析器。

scan all source files for includes

扫描include文件所包含的所有源文件。

validate built product

这个选项决定了是否在编译的时候进行验证。验证的内容和app store的审查内容一致。默认选项是debug时不验证,release时验证,这样就保证了每个release版本都会通过validate,让被拒的风险在提交app store之前就暴露出来,减少损失。

注意:

1. 这个选项只在连接真机的时候有效。在使用模拟器时无效。不过我用真机试了一下,似乎也没有检查出代码里的私有api。

2. 想手动validate,可以在organizer->archives里找到需要检查的archive,点击validate按钮即可。这样检查似乎靠谱些,可以查出私有api等违规操作。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网