针对不同构建配置的不同Bundle

针对不同构建配置的不同Bundle

本文介绍了针对不同构建配置的不同Bundle Identifier的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我们正在尝试针对临时环境以及生产环境进行一些测试。当然,我已经创建了Stage和Prod构建配置以在两者之间切换,但我的客户希望将两者并排安装,以便他们可以轻松地在两个环境之间切换。到目前为止,我一直在使用不同的包标识符和包显示名称维护我的代码分支,因此可以并排安装和测试它们。不过,我开始怀疑是否有更简单的方法可以做到这一点。有没有办法可以定义自定义构建设置,根据构建配置给它一个值,然后将它附加到包标识符的末尾?

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喜欢......

Something like...

BUNDLE_SUFFIX
    TEST
    STAGE
    PROD    ".PROD"

...然后将我的Bundle Identifier设置为 com.blah.blah $( BUNDLE_SUFFIX)。然后使用PROD配置的所有构建将自动获得新的bundle id,并且我不必一直同步分支。这种事情甚至可能吗?

...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?

推荐答案

是的,你走在正确的轨道上。这是一个很好的教程:

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/

这篇关于针对不同构建配置的不同Bundle Identifier的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:01