ios 不同构建配置的不同捆绑标识符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11198826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Different Bundle Identifier for different build configurations
提问by Jose Ibanez
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?
我现在正在开发一个应用程序,我们正在尝试针对暂存环境和生产环境进行一些测试。当然,我已经创建了“Stage”和“Prod”构建配置来在两者之间切换,但我的客户希望将两者并排安装,以便他们可以轻松地在两种环境之间切换。到目前为止,我一直通过使用不同的包标识符和包显示名称维护我的代码分支来做到这一点,因此可以并排安装和测试它们。不过,我开始怀疑是否有更简单的方法来做到这一点。有没有一种方法可以定义自定义构建设置,根据构建配置为其赋予一个值,然后将其附加到包标识符的末尾?
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?
...然后将我的捆绑标识符设置为com.blah.blah$(BUNDLE_SUFFIX)
. 然后所有使用 PROD 配置的构建都将自动获得新的包 ID,我不必一直同步分支。这种事情甚至可能吗?
采纳答案by Tim Camber
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/
是的,你走在正确的轨道上。这是一个不错的教程:http: //nilsou.com/blog/2013/07/29/how-to-have-two-versions-of-the-same-app-on-your-device/