Requirement background: Requirements such as the need to switch request links are often used in the development test release process. That is: test, pre-release, release environment link is different, if we configure in the project, each packaging is very inconvenient. This is where Settings.bundle comes in. Click on Settings to switch environment directly.

Steps:

1. Create the root. plist file.

2. After the root. plist file is created, it will be automatically generated in the project. The system also provides several default Settings.

Effect after running:

What each setting means:

3. Customize the values you want to set

The system gives you a specific type and you can select it directly

Examples of Settings

4.Multi Settings need to be slightly careful:

Effect:

The value 5.

I’ll just use [NSUserDefaults standardUserDefaults]. Key is the value of that Identifier that you set. To display Keys more clearly, right-click the blank area and select Show Row Keys/Values

Example value:
NSString *name = [[NSUserDefaults standardUserDefaults] objectForKey:@"personal_name_key"];
    NSLog(@"Setting Default Name = %@", name);
Copy the code

Postscript: Special attention:

If you get the message directly from the above code after running the application, you’ll get NULL; The reason: root.plist is really just a static file to display in Settings; It only adds to NSUserDefaults if you modify it. After configuration modification, NSUserDefaults takes precedence over root.plist files.