从 Xcode 编译应用程序以进行部署

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

Compile application from Xcode for deployment

objective-cxcodemacos

提问by QuantumPhysGuy

I feel really stupid for asking a question like this, but I cannot seem to figure it out. I have an application that I wrote in Xcode 4.0.2 that targets Mac OS X. How do I compile this to an application bundle (.app) so I can make it available for people to test?

问这样的问题我觉得很愚蠢,但我似乎无法弄清楚。我有一个在 Xcode 4.0.2 中编写的针对 Mac OS X 的应用程序。如何将其编译为应用程序包 (.app) 以便人们可以对其进行测试?

Thanks in advance.

提前致谢。

回答by willbur1984

If you are using Xcode 4, just click the 'Archive' command in the 'Product' menu. It will build your app using the Release build configuration so it's suitable to run on other computer's besides your own.

如果您使用的是 Xcode 4,只需单击“产品”菜单中的“存档”命令。它将使用发布构建配置构建您的应用程序,因此它适合在您自己的计算机之外的其他计算机上运行。

Once it's done building, it will open up the Organizer window with the Archives item selected and highlight the new archive it just created for your application.

完成构建后,它将打开管理器窗口,并选择存档项目并突出显示它刚刚为您的应用程序创建的新存档。

Click the 'Share...' button and select 'Application' in the radio group, then click 'Next' which will bring down a save panel where you can pick a location to actually save the app bundle and do whatever you want with it from there.

单击“共享...”按钮并在单选组中选择“应用程序”,然后单击“下一步”,这将打开一个保存面板,您可以在其中选择一个位置来实际保存应用程序包并对其执行任何操作从那里。

回答by knl

Although I am not exactly sure how Xcode 4 handles the build directory of Mac apps, the last time I developed for Mac OS X, the application bundle could be found in /projectname/build/Debug. The specific directory inside the /build/ folder may differ according to the settings you set up, just look around a little. You can also specify the build location in your project build settings.

虽然我不确定 Xcode 4 如何处理 Mac 应用程序的构建目录,但上次我为 Mac OS X 开发时,可以在 / projectname/build/Debug 中找到应用程序包。/build/文件夹里面的具体目录可能会根据你设置的不同而有所不同,随便看看就行了。您还可以在项目构建设置中指定构建位置。

回答by MarkHu

The .app bundle is a folder structure. Here's an example of a cross-platform app that uses a simple shell script to put the compiled assets into the right subdirectories:

.app 包是一个文件夹结构。这是一个跨平台应用程序的示例,该应用程序使用简单的 shell 脚本将编译后的资产放入正确的子目录中:

http://git.gnome.org/browse/tomboy/tree/bundle-mac-app.sh

http://git.gnome.org/browse/tomboy/tree/bundle-mac-app.sh