Xcode ToolsMidOpen-ended
How do you configure an iOS app to support multiple environments (Dev, SIT, UAT, Prod) so all can be installed simultaneously on the same device?
Explanation & Code
Use separate Xcode Schemes, Build Configurations, Bundle Identifiers, and Firebase plists — one set per environment.
| Environment | Bundle ID Suffix | Firebase Plist | App Display Name |
|---|---|---|---|
| Dev | .dev | GoogleService-Info-Dev.plist | YourApp Dev |
| SIT | .sit | GoogleService-Info-SIT.plist | YourApp SIT |
| UAT | .uat | GoogleService-Info-UAT.plist | YourApp UAT |
| Prod | (none) | GoogleService-Info.plist | YourApp |
Step-by-step:
- Schemes — Product → Scheme → Manage Schemes →
+→ name itDev,SIT,UAT(Prod reuses the default). - Build Configurations — Project (root) → Info → Configurations →
+(Duplicate) → name to match environment. - Link scheme to config — Edit Scheme → each action (Run/Test/Archive/etc.) → set Build Configuration to the matching one.
- Firebase plists — Download from each Firebase console, rename (
GoogleService-Info-Dev.plist, etc.), drag all into Xcode with Target Membership checked. Do not conditionally exclude them from the bundle — all four must be present at runtime. - Active Compilation Conditions — Target → Build Settings →
Active Compilation Conditions→ setDev,SIT,UATper config; leave Prod empty. - Bundle Identifiers — Signing & Capabilities → switch configuration → set unique bundle ID per config.
- App Display Name — Add a User-Defined Build Setting
APP_DISPLAY_NAMEwith a value per config, then setCFBundleDisplayName=$(APP_DISPLAY_NAME)in Info.plist.
Rate your understanding: