简体   繁体   English

Xcode具有相同包标识符的不同目标

[英]Xcode different targets with same bundle identifier

My scenario is that I have one project with two targets; 我的情况是我有一个有两个目标的项目。 one for the customer and the second one for the buyer. 一个给客户,第二个给买方。

I need those two targets to share the same bundle identifier like (com.company.app) because I want to have only one APNs certificate to overcome the complexity on the server side so both of them share the same APNs settings. 我需要这两个目标共享相同的捆绑标识符,例如(com.company.app),因为我只想拥有一个APNs证书来克服服务器端的复杂性,因此它们都共享相同的APNs设置。

Note: Only one app will be on the App store, the other one will be distributed through in house method. 注意:只有一个应用程序会出现在App Store中,另一应用程序将通过内部方式进行分发。

So is that possible to have the same bundle identifier? 那么有可能具有相同的包标识符吗?

What do you mean by in-house distribution method? 内部分配方法是什么意思? Will you still post it thru TestFlight in iTunes or distribute the IPA in house so that they can install it manually? 您是否仍可以通过TestFlight将其发布到iTunes中,还是将IPA内部分发,以便他们可以手动安装它?

If you want to distribute it via TestFlight then you cannot have two apps with the same bundle id. 如果要通过TestFlight分发它,则不能有两个具有相同捆绑软件ID的应用程序。 You have to differentiate it. 您必须区分它。 I recommend that you use the same app but then use some kind of Settings bundle for in house distribution in case you want to control the configuration of the app for app store and in house audience. 我建议您使用相同的应用程序,但如果要控制应用程序商店和内部受众群体的应用程序配置,则可以在内部分发中使用某种“设置”捆绑包。

You can try another method. 您可以尝试其他方法。 You can use the Build number or CFBundleVersion property to differentiate between the two builds. 您可以使用内部版本号或CFBundleVersion属性来区分两个内部版本。 I am presuming that there will be some difference between the app store version and the in house version of the same app such as pointing to different servers if your app uses a server. 我假设同一应用程序的应用程序商店版本和内部版本之间会有一些差异,例如,如果您的应用程序使用服务器,则指向不同的服务器。 In this case you can use even numbered builds for app store and odd numbered build for in house distribution. 在这种情况下,您可以将偶数编号的版本用于应用商店,而将奇数编号的版本用于内部分发。

Then in the app you can check the build number and provide different behaviour for app store an in house versions of the app without having to rebuild the app. 然后,在应用程序中,您可以检查内部版本号,并为应用程序商店的内部版本提供不同的行为,而不必重新构建应用程序。 Only thing you have to do in the two targets is to ensure that the bundle numbers are set as even and odd respectively. 在这两个目标中只需要做的就是确保将束号分别设置为偶数和奇数。 You can do this in Run script phase where in can change the CFBundleVersion of the Info.plist of each target accordingly. 您可以在运行脚本阶段执行此操作,在该阶段可以相应地更改每个目标的Info.plist的CFBundleVersion。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM