使用 Xcode 4 运行发布版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5387076/
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-09 03:49:02  来源:igfitidea点击:

Running a release build with Xcode 4

xcodebuildrelease

提问by Joey

I see how Xcode 4 splits the info on your targets nicely in one view, but how does one build and run these different builds? All I see are the options to build and to run, and these options to build for running, testing, and profiling. It's not clear to me how these map to the build configurations, though.

我看到 Xcode 4 如何在一个视图中很好地拆分目标上的信息,但是如何构建和运行这些不同的构建?我所看到的只是构建和运行的选项,以及为运行、测试和分析而构建的这些选项。不过,我不清楚这些如何映射到构建配置。

回答by Adam Bryzak

Xcode 4 introduces schemes which provide all the options on how to build/run/profile/etc. your application. You can change the active scheme using the Schemedrop-down button at the top of the project window and/or edit the scheme via Product > Edit Scheme… ?<menu item. Then on the left source list, you can select the Runitem, and in the Infotab in the right pane you can choose to use the Releaseconfiguration in the Build Configurationdrop-down.

Xcode 4 引入了提供有关如何构建/运行/配置文件/等的所有选项的方案。你的申请。您可以使用Scheme项目窗口顶部的下拉按钮更改活动方案和/或通过Product > Edit Scheme… ?<菜单项编辑方案。然后在左侧的源列表中,您可以选择该Run项目,Info在右侧窗格的选项卡中,您可以选择使用下拉列表中的Release配置Build Configuration

回答by Rick Bidlack

In Xcode 4.3 -- go to Product/Build For and select Archiving. This compiles a release build and places it in an obscure folder which you'll never find on your own. The quickest way to get there is to select your app in Xcode's project navigator (in the Products folder), right-click, select Show in Finder. It will take you to the debug build but the release build is in a folder right next to it.

在 Xcode 4.3 中——转到 Product/Build For 并选择 Archiving。这会编译一个发布版本并将其放置在一个你永远找不到的模糊文件夹中。到达那里的最快方法是在 Xcode 的项目导航器(在 Products 文件夹中)中选择您的应用程序,右键单击,选择在 Finder 中显示。它将带您进入调试版本,但发布版本位于它旁边的文件夹中。

回答by Malloc

To add to Adam Bryzak answer, you need to activate the DEBUG and release (and adhoc if needed) in the build settings settings.

要添加到 Adam Bryzak 答案,您需要在构建设置设置中激活调试和发布(如果需要,还需要临时发布)。

Under project/Build settings, search for Preprocessor Macros and set the Debug and release values to 1 in order to activate them:

在项目/构建设置下,搜索预处理器宏并将调试和发布值设置为 1 以激活它们:

enter image description here

在此处输入图片说明

This way, in the edit schemes, when you switch between DEBUG and release, Xcode will know that he should to change the build mode.

这样,在编辑方案中,当你在 DEBUG 和 release 之间切换时,Xcode 就会知道他应该改变构建模式。