简体   繁体   English

Xcode:在相同的目标(具有相同的plist)中构建两个应用

[英]Xcode : build two apps in same target (with the same plist)

Now I have 3 targets in my iOS application so I build 3 apps (3 ipa). 现在,我的iOS应用程序中有3个目标,因此我构建了3个应用程序(3个IPA)。 But I want to keep only 3 target but I want to generate 6 apps (6 ipa). 但是我只想保留3个目标,但我想生成6个应用程序(6个IPA)。

On each target I want to create an app and a pilot app. 在每个目标上,我想创建一个应用程序和一个试用应用程序。 I really want to keep only 1 plist for app and pilot app. 我真的只想为应用程式和试验性应用程式保留1个清单。 Only differences with app and pilot app are : 与app和试用版app的唯一区别是:

  • Bundle identifier (to install these two apps on the same device) 捆绑包标识符(用于在同一设备上安装这两个应用程序)
  • Icon application 图标应用
  • 1 parameter in plist plist中的1个参数
  • Few line in code (changing with #IF PILOT add code #ENDIF 代码中的几行(更改为#IF PILOT,添加代码#ENDIF

It's important to keep the same plist for each target (a target is equivalent to en environment TEST, INT and PROD). 对于每个目标,保持相同的plist很重要(一个目标等效于环境TEST,INT和PROD)。 Because if I duplicate my target in two target (PROD and PROD PILOT for example) it will be more difficult to maintain thes application because if a day I want to change something in plist I will do the same in PILOT target plist. 因为如果我将目标复制到两个目标(例如PROD和PROD PILOT)中,将很难维护该应用程序,因为如果一天我想更改plist中的某些内容,我将在PILOT目标plist中执行相同的操作。 So you understand it can create differences if I forget to dusplicate my changements. 因此,您知道,如果我忘记重复更改,它会带来差异。

Finally it will be great if I can build the app and the pilot app just in 1 build and generate 2 Archives in one time also. 最后,如果我可以一次构建该应用程序和试用应用程序,并且一次生成2个存档,那将是很棒的。

Is it possible ? 可能吗 ? And have you ideas for the realisation ? 您有实现的想法吗?

Me I have just fews ideas like : 我,我只有一些想法,例如:

  • Add arguments in my target 在目标中添加参数
  • Add user defined setting 添加用户定义的设置
  • Add preprocessing macros 添加预处理宏

Thanks 谢谢

在项目设置下,对于每个目标,请在“构建设置”->“打包”下查看,尝试将所有info.plist文件设置为指向同一文件而不是其各自的版本。

If it is testing purpose, Try changing Bundle identifier in Project settings and change Product Name in build settings and take archive files. 如果是出于测试目的,请尝试在“项目”设置中更改“捆绑包”标识符,并在构建设置中更改“产品名称”,并获取存档文件。 It will be deployed as separate app in device. 它将作为单独的应用程序部署在设备中。

Thanks Fonix ! 谢谢Fonix!

My solution use your advice. 我的解决方案使用您的建议。 I duplicated my 3 targets but an app target and its pilot version are linked to the same plist file. 我复制了3个目标,但将一个应用目标及其试用版链接到同一plist文件。 Moreover, I had a preprocessor macro "PILOTE=1" in each pilote version. 此外,在每个试用版本中都有一个预处理程序宏“ PILOTE = 1”。 Finally I declare a string in user-defined to define my icon ("ICON -> icon.png or icon-pilote.png) and I declare in CFBundleIcon item0 -> ${ICON}). 最后,我在用户定义中声明一个字符串以定义我的图标(“ ICON-> icon.png或icon-pilote.png”),并在CFBundleIcon item0-> $ {ICON}中声明)。

And to add part of code I juste declare the code difference in : 并添加部分代码,我只是在中声明代码差异:

#IFDEF PILOTE #IFDEF飞行员

//Code Pilot version //代码试用版

#ELSE #其他

//Code standard version //代码标准版

#ENDIF #万一

Is it a nice choice for my needs ? 这是我需要的不错选择吗?

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

相关问题 两个Xcode项目,相同的目标 - Two Xcode projects, same target 我是否可以为具有不同捆绑ID的两个iOS应用使用相同的Firebase GoogleService-Info.plist? - Can I use the same Firebase GoogleService-Info.plist for two iOS apps that have different bundle ids? 在XCode中的一个目标中有两个GoogleService-Info.plist - Have two GoogleService-Info.plist in one target in XCode Copy Bundle Resources 构建阶段包含此目标的 Info.plist 文件 'Info.plist' in xcode 6? - The Copy Bundle Resources build phase contains this target's Info.plist file 'Info.plist' in xcode 6? 对多个 Xcode 目标使用相同的版本号 Info.plist - Using same version number for multiple Xcode targets Info.plist 在info.plist(Xcode)中使用相同的包标识符进行不同的构建 - using same bundle identifier in info.plist (Xcode) for different builds 将Framework和App添加为同一Xcode项目的目标 - Adding Framework and App as the target for same Xcode project 在Xcode中为不同的目标使用相同的代码 - Using the same code for different target in Xcode 如何使用同一CloudKit数据库构建两个不同的应用程序? - How can I build two different apps using the same CloudKit database? Xcode上的两个数组和两个UITableview相同的ViewController - Two array and Two UITableview same viewcontroller on Xcode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM