Last active
August 29, 2015 14:13
-
-
Save AlexHedley/879e80de094b983c13e3 to your computer and use it in GitHub Desktop.
NSUserDefaults with own plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSString *defaultPrefsFile = [[NSBundle mainBundle] pathForResource:@"defaultPrefs" ofType:@"plist"]; | |
| NSDictionary *defaultPrefs = [NSDictionary dictionaryWithContentsOfFile:defaultPrefsFile]; | |
| [[NSUserDefaults standardUserDefaults] registerDefaults:defaultPrefs]; | |
| //Get | |
| NSString *strBaseURL = [[NSUserDefaults standardUserDefaults] stringForKey:@"BaseURL"]; | |
| //Set | |
| [[NSUserDefaults standardUserDefaults] setObject:baseURL forKey:@"BaseURL"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSURL *defaultPrefsFile = [[NSBundle mainBundle] URLForResource:@"DefaultPreferences" withExtension:@"plist"]; | |
| NSDictionary *defaultPrefs = [NSDictionary dictionaryWithContentsOfURL:defaultPrefsFile]; | |
| [[NSUserDefaults standardUserDefaults] registerDefaults:defaultPrefs]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment