Different Bundle Identifier for different build co

2020-02-17 09:24发布

问题:

I'm working on an app right now and we're trying to get some testing done against the staging environment as well as the production environment. Naturally, I've created "Stage" and "Prod" build configurations to switch between the two, but my client would like to have the two installed side by side so they could switch between the two environments easily. I've been doing this so far by maintaining a branch of my code with a different bundle identifier and bundle display name, so they can be installed and tested side by side. I'm beginning to wonder if there may be an easier way to do this, though. Is there a way I could define a custom build setting, give it a value based on the build configuration, and then append that to the end of the bundle identifier?

Something like...

BUNDLE_SUFFIX
    TEST
    STAGE   
    PROD    ".PROD"

...and then set my Bundle Identifier to com.blah.blah$(BUNDLE_SUFFIX). Then all builds with the PROD config will automatically get the new bundle id and I won't have to synchronize branches all the time. Is that kind of thing even possible?

回答1:

Yep, you're on the right track. Here is a nice tutorial: http://nilsou.com/blog/2013/07/29/how-to-have-two-versions-of-the-same-app-on-your-device/



回答2:

In Xcode 7:

this can be done easily using the packaging configuration in build setting



标签: ios xcode