简体   繁体   English

命令行工具可从一个XCode IOS项目生成多个应用程序

[英]Command line tools to generate multiple apps from one XCode IOS project

I'm working on an IOS project where we need to generate different branded or customized applications from the same source project. 我正在做一个IOS项目,我们需要从同一源项目中生成不同的品牌或自定义应用程序。 Such customization consists of different images, strings, application name, and (possibly) different developer ID. 这种自定义包含不同的图像,字符串,应用程序名称,以及(可能)不同的开发人员ID。

According to the information I've found searching the web, the preferred way to do this is to add targets to the project, which seems pretty straightforward as a manual task. 根据我在网上搜索到的信息,执行此操作的首选方法是将目标添加到项目中,这作为手动任务似乎很简单。 However, my intend is being able to add targets using some command line tool or script so that the process of generating a customized or branded app can be automatized. 但是,我的意图是能够使用某些命令行工具或脚本添加目标,以便可以自动生成定制或品牌应用程序。

For example, let's say I'm want to generate a branded app for some company, which has to include their logos, brand names, etc. The desired way to do this would becreating a configuration file where the customized parameters are specified (applogo='logo.jpg'; appname='brandedApp'; ...), and then calling a script that will take such config file as parameter and (after some steps still unknown for me) will compile the project, generating the branded application. 例如,假设我要为某家公司生成品牌应用程序,该应用程序必须包含其徽标,品牌名称等。实现此目标的理想方法是创建一个配置文件,其中指定了自定义参数(applogo = 'logo.jpg'; appname ='brandedApp'; ...),然后调用一个脚本,该脚本将配置文件作为参数,并且(在我仍然不知道某些步骤之后)将编译项目,生成品牌应用程序。 The idea is performing this branding task pretty often, so entering the app parameters would be the only manual step in this process. 这个想法是经常执行此品牌宣传任务,因此输入应用程序参数将是此过程中唯一的手动步骤。

Is there any way I can accomplish this? 我有什么办法可以做到这一点? As far as I know, there is no way to add/edit targets to a XCode project from command line, but maybe I'm wrong on this. 据我所知,无法从命令行向XCode项目添加/编辑目标,但是也许我错了。

And, is there any classic approach to solve this problem? 而且,有没有经典的方法可以解决此问题?

Thank you very much. 非常感谢你。

Look into project settings->build phases, you can run a script before/after building your project. 查看项目设置->构建阶段,可以在构建项目之前/之后运行脚本。 You can also create various XCode targets for different logo/appname. 您还可以为不同的徽标/应用名称创建各种XCode目标。 This is the most 'elegant' and only way for now. 这是目前最“优雅”且唯一的方法。

I'm also building same App for different publishers with different logo/name. 我还在为具有不同徽标/名称的不同发行商构建相同的应用程序。 Apple DID provide some methods to build targets in command line in lower version of XCode, but it's not avaliable for newer version since XCode 4(it's been a long time, hope my memory is right). Apple DID提供了一些在较低版本的XCode中在命令行中构建目标的方法,但是自从XCode 4起已经存在了很长时间,希望我的记忆正确,但是对于较新的版本则不可用。

Basically, I won't go into deep details, you need to create a new Target . 基本上,我不会深入探讨,您需要创建一个新的Target Add your branded images and new localization files to Target Membership (press CMD-Alt-1) and you will see target membership. 将品牌图像和新的本地化文件添加到目标成员身份 (按CMD-Alt-1),您将看到目标成员身份。

This way, only the files that belong to the target membership will be compiled for each Target. 这样,将仅为每个目标编译属于目标成员资格的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我有 Xcode 命令行工具,我真的需要 Xcode GUI 来开发 iOS 应用程序吗? - I have Xcode command line tools, do I really need the Xcode GUI to develop iOS apps? XCode:使用命令行工具,如何从文件夹创建git并将其导入项目中 - XCode : Using the command line tools, how do I create a git from a folder and import that on a project 从一个 Pinpoint 项目向多个 iOS 应用程序发送推送通知 - Send push notifications from one Pinpoint project to multiple iOS apps 使用xcode命令行工具提交iOS应用商店 - iOS appstore submission using xcode command line tools Mac 使用 iOS SDK 为 xcode 安装命令行工具 - Mac install command line tools for xcode with iOS SDK 使用 Xcode 12 xctrace 命令行工具自动分析 iOS - Automate profiling for iOS using Xcode 12 xctrace command line tools 如何从命令行构建 Xcode 项目? - How to build Xcode project from the command line? Xcode / IOS 具有相同代码库/项目的多个应用程序 - Xcode / IOS multiple apps with same code base / project 'xcode-select -p' 返回的 Xcode 命令行工具不是来自 Xcode - Xcode command line tools, as returned by 'xcode-select -p', are not from Xcode 如何从命令行编译iOS项目 - How to compile an iOS project from command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM