We have an app that we build both for enterprise and for app store. This requires us to make a couple settings
- The bundle identifier
- The Development team
Currently we use 2 branches with the enterprise branch as the master and the app store branch as the secondary, and we just merge master into the app store branch before submitting.
I would like to eliminate this step and build both versions at the same time.
What would be the best way to do this?
I have one additional requirement. It is a mixed Swift and objective-c project and I want the ability to have code specific to the app store version and code specific to the enterprise version. I envision using something like an #ifdef
Any suggestions on a solution to this, or does keeping it on 2 branches make the most technical sense.
First you can duplicate Release Configuration in you settings to add AppStore Configuration.
Add Prepocessor macros for every configuration you have.
Manage you schemes to have an App Store build configuration
- You will now have two targets but you will need to build one after the other.
- For the code part, on your code you will have to manage every macros in code.
You can create two targets (one for enterprise, one for App Store) within the project that share the same code, but are signed with different code-signing identities. That will also allow you to set separate pre-processor macros for your enterprise and App Store versions.
It depends on kind of differences between Enterprise and Apple Store versions.
If it's business logic differences then may be it makes sense to have two branches, because app versions can have different specs, so it will be difficult to support one code base.
If it's just configuration differences then I propose to use two targets (Enterprise, AppStore).
In every target build settings set suitable macros.
The same has to be done for AppStore target build settings.
Usage in code:
Settings *settings = nil;
settings = [[EnterpriseSettings alloc] init];
settings = [[AppStoreSettings alloc] init];
In Swift you can use
#if / #else / #endif macros:
var settings: Settings! = nil
settings = EnterpriseSettings()
settings = AppStoreSettings()
In Xcode you can duplicate your build target. Then you can specify own team and bundle for each target. In addition you can have own macro defined to make variation in the code and/or include/exclude some source code files from each target