xcode 为什么“仅构建活动架构”甚至是发布版本的一个选项?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30271176/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:09:50  来源:igfitidea点击:

Why is "Build Active Architecture Only" even an option for release builds?

iosxcode

提问by Adam Johns

enter image description here

在此处输入图片说明

Why would anyone ever set this option to YES for a release build in practice? So you gain a little build time, but how often do you make release builds? And why would you ever want only the architecture for a release build to be only that of the connected device (even if your connected device has the lowest common denominator of backwards compatible architectures you are supporting)?

为什么有人会在实践中将此选项设置为 YES 以用于发布版本?因此,您获得了一些构建时间,但是您多久进行一次发布构建?为什么您希望发布版本的架构仅是连接设备的架构(即使您的连接设备具有您支持的向后兼容架构的最低公分母)?

采纳答案by Duncan C

Release is not just for submitting to the app store. Selecting a release build turns on lots of compiler optimizations that generate fast code, and the memory footprint is different. It can be useful to test release builds for various reasons.

发布不仅仅是为了提交到应用程序商店。选择发布版本会开启大量编译器优化以生成快速代码,并且内存占用不同。出于各种原因测试发布版本可能很有用。

Swift code in particular is really slow in debug builds if it deals with lots of arrays. It's better with Swift 1.2, but still quite slow.

如果 Swift 代码处理大量数组,那么它在调试构建中的速度尤其慢。使用 Swift 1.2 会更好,但仍然很慢。

If you're testing on your development device it doesn't really make sense to compile for all the different supported architectures. Building is much faster for just your active architecture.

如果您正在开发设备上进行测试,那么针对所有不同的受支持架构进行编译实际上没有意义。对于您的活动架构,构建速度要快得多。

回答by Greg

The Debug and Release options you see there are just the auto-created build configurations. You can add more, and name them whatever you want.

您在那里看到的 Debug 和 Release 选项只是自动创建的构建配置。您可以添加更多,并随意命名它们。

The option is there for each individual build configuration in your project for flexibility. The Release configuration is not special from Xcode's perspective.

该选项适用于项目中的每个单独的构建配置,以获得灵活性。从 Xcode 的角度来看,Release 配置并不特殊。

As an example, here's the list of configurations in one of my projects:

例如,这是我的一个项目中的配置列表:

You can add more configurations in the info tab of the project info, then they will be displayed separately under each build setting that you expand, so you can configure them separately.

您可以在项目信息的信息选项卡中添加更多配置,然后它们将在您展开的每个构建设置下单独显示,因此您可以单独配置它们。