Platformsios 6.0, requires ARC
FrameworksFoundation, Security

CI Status

Made with ♥︎ at Supercharge


With SCConfiguration you can easily manage environment dependent (or global) configuration parameters in a property list file.

Moreover, from version 1.1.0 you can encrypt your configuration file if it contains sensitive information.


SCConfiguration is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SCConfiguration"


Defining the parameters in the Configuration.plist file

First, you need to create a configuration file called Configuration.plist in your project.


You can add global or environment dependent key-value pairs to it, here’s an example with STAGING and PRODUCTION environments.

In source format:

    <key>APPLE_APP_ID</key> <!-- global parameter -->
    <key>API_URL</key>  <!-- environment dependent parameter -->

Setting the environment and reading the parameters

If ENV is a preprocessor macro defined by the build configuration you can easily set the configuration class’s environment in the application:didFinishLaunchingWithOptions: method:

SCConfiguration *configuration = [SCConfiguration new];

// Set the environment defined by the ENV preprocessor macro
[configuration setEnv:ENV];

// Read the API_URL environment dependent value from the configuration
NSString *apiUrl = [configuration configValueForKey:@"API_URL"]

You can also use SCConfiguration as a singleton:

// Set the environment defined by the ENV preprocessor macro
[[SCConfiguration sharedInstance] setEnv:ENV];

// Read the API_URL environment dependent value from the configuration
NSString *apiUrl = [[SCConfiguration sharedInstance] configValueForKey:@"API_URL"]

Encrypting your Configuration file

If you’re using v1.1.0 or above, with a few additional steps you can encrypt your configuration file. This is very useful if the file contains sensitive information such as production API URLs, third party App IDs or client secrets.

The initial problem here is that by default your Configuration.plist file will be added to the .ipa file without encryption. If someone downloads your application from the App Store, unpacks the .ipa file and checks the app’s contents, the Configuration file will be there as a plain XML file.

The solution is to remove the plist file from the build, add it as encrypted file with the help of a custom run script and use the SCConfiguration library to read the encrypted file.

Encryption steps:

1) select your Configuration.plist file in Xcode and UNCHECK the target membership in the Utilities plane / File inspector tab:

Uncheck membership

2) add a new custom Run Script to your project’s Targets with the name Encryption and with the following content:

openssl enc -e -aes-256-cbc -in "$PROJECT_DIR/SCConfiguration/Configuration.plist" -out "$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/Configuration.enc" -pass pass:<your password here>

IMPORTANT: You need to replace the Configuration.plist file’s path to mach your project’s structure and also you should add your own password to this script.

Add custom Run Script

3) you need to add an extra line to the application:didFinishLaunchingWithOptions: method:

[[SCConfiguration sharedInstance] setDecryptionPassword:@"<your password here>"];

Subclassing SCConfiguration

It’s a good practice to subclass SCConfiguration and declare your configuration parameters explicitly in your application.

// MyAppConfiguration.h

@interface MyAppConfiguration : SCConfiguration

- (NSString *)apiUrl;

// MyAppConfiguration.m

@interface MyAppConfiguration : SCConfiguration

- (NSString *)apiUrl
    return (NSString *)[self configValueForKey:@"API_URL"];


Overriding configuration variables

You can override configuration variable at runtime. This can be useful if you would like to synchronize configuration parameters through a backend service.

You can overwrite / add key-value pairs:

  • one-by-one:
[[SCConfiguration sharedInstance] setObject:@"a value" forKey:@"key1"];
  • multiple keys at the same time:
NSDictionary *newConfigValues = @{ @"key1": @"new value", @"new key": @"new value" };
[[SCConfiguration sharedInstance] overwriteConfigWithDictionary:newConfigValues];

NOTE: overwritten key-value pairs will stay between application launches by default! You can change this behaviour by calling the [[SCConfiguration sharedInstance] setOverwriteStateToPersistent:NO].

Or you can set key-value pairs to protected / unprotected:

[[SCConfiguration sharedInstance] setKeysToProtected:@[@"key2", @"key3"]];
[[SCConfiguration sharedInstance] setKeyToProtected:@"key4"];

[[SCConfiguration sharedInstance] removeAllKeyFromProtection];

Protected values cannot be changed / added later.


iOS 6+


Contributions are always welcome! (:

  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request


SCConfiguration is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "SCConfiguration",
    "version": "2.2.0",
    "summary": "With SCConfiguration you can easily manage encrypted, environment dependent (or global) configuration parameters in a property list file.",
    "homepage": "",
    "source": {
        "git": "",
        "tag": "2.2.0"
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Supercharge": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "6.0"
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": [

Pin It on Pinterest

Share This