When distribution app on app store should I also set Build Configuration
in Xcode
from edit scheme
like this

- 3,063
- 3
- 33
- 66
2 Answers
I would recommend to set up two schemas.
First one: Development -> setup with Debug
build configuration.
You can use this while you are developing your app. This will give you logging, easy debugging, etc..
Second one: Distribution -> setup with Release
build configuration.
Logging will not happen on this schema, also debugging will be unavailable, because the build is not optimizaed for that.
When you are preparing your submittal to the App Store, archive the Distribution schema using the Release
build configuration.
You can find some more detailed description here about the difference between Debug
and Release
build configurations.

- 1
- 1

- 6,081
- 2
- 27
- 43
-
If you refer to print() as logging, that will happen in release builds also, if you do not actively suppress it. – shallowThought Oct 28 '16 at 16:14
This will cover your question in depth. I have used build configuration environment so that if you make a build in release Configuration. your automatic values will be se according to release version. you can also download the sample code from the link below to see actually what happens when you change the scheme.
First step.
Add the variable "Configuration" in your info.plist and add value "$(CONFIGURATION)" there.
Make a Config.swift file and copy paste the below code there.
`
import Foundation
private let configManagerSharedInstance = ConfigManager()
class Config {
class var sharedInstance: ConfigManager {
return configManagerSharedInstance
}
}
// You can put as much Environment as you need but you make sure you also put these environment in the config.plist file.
enum Environment: String {
case Debug = "Debug"
case Production = "Release"
}
class ConfigManager: NSObject {
private var environment: Environment?
var config: NSDictionary?
override init() {
super.init()
// Retrieve the current evironment from the main bundle
if let currentEnvironment = Bundle.main.infoDictionary?["Configuration"] as? String {
// Store the current environment for later use
environment = Environment(rawValue: currentEnvironment)
if let projectConfigPath = Bundle.main.path(forResource: "Config", ofType: "plist") {
if let projectConfigContents = NSDictionary(contentsOfFile: projectConfigPath) as? Dictionary<String, AnyObject> {
config = projectConfigContents[currentEnvironment] as? Dictionary<String, AnyObject> as NSDictionary?
}
} else {
print("config file not found")
}
}
}
func getCurrentEnvironment() -> Environment? {
return self.environment
}
func configForKey(key: String) -> String {
return config?[key] as! String
}
//It will use to get sub dictionary and their values.
func configForCategory(category: String, andKey: String) -> String {
let configuration = config?.value(forKeyPath: category) as! NSDictionary
return configuration.value(forKeyPath: andKey) as! String
}
}
`
I have also made a file Constants.swift in which i have set the varibles using the above code. `
//
// Constants.swift
// BuildConfiguration
//
// Created by Ourangzaib khan on 4/6/17.
// Copyright © 2017 Ourangzaib khan. All rights reserved.
//
let kBASE_URL : String = {
print(Config.sharedInstance.configForKey(key: "kBASE_URL"));
return Config.sharedInstance.configForKey(key: "kBASE_URL")
}()
let STRIPEKEY : String = {
return Config.sharedInstance.configForCategory(category: "Stripe", andKey: "Publishable Key")
}()
let PUBNUBKEYSUBSCRIBE : String = {
return Config.sharedInstance.configForCategory(category: "PubNub", andKey: "Publish Key")
}()
let PUBNUBKEYPUBLISH : String = {
return Config.sharedInstance.configForCategory(category: "PubNub", andKey: "Subscribe Key")
}()
let WOWZAKEY : String = {
return Config.sharedInstance.configForKey(key: "Wowza");
}()
`
Now you just have to select the environment using edit sceme go into the edit scheme and chose Build Configuration Now when you will run the project you will see this output WRT build configuration in below images.

- 1,114
- 18
- 20