简体   繁体   中英

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.

Note: Only one app will be on the App store, the other one will be distributed through in house method.

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?

If you want to distribute it via TestFlight then you cannot have two apps with the same bundle 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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