Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm having trouble reading the root.inApp.plist #11

Closed
mnifield opened this issue Sep 1, 2010 · 3 comments
Closed

I'm having trouble reading the root.inApp.plist #11

mnifield opened this issue Sep 1, 2010 · 3 comments

Comments

@mnifield
Copy link

mnifield commented Sep 1, 2010

Any help would be awesome, i at a dead end as to how to retrieve the data using your program from the plist files in settings bundle. Do you need to initialize the settings in the delegate and if not how do you get the data into a dic or array so i can use them in the app.

Sorry for the noob question its my first big app and i've never used settings bundle before.

Thanks

Matthew

@futuretap
Copy link
Owner

NSUserDefaults is your friend. To read a string with key "foo":

NSString *foo = [[NSUserDefaults standardUserDefaults] stringForKey:@"foo"];

@mnifield
Copy link
Author

mnifield commented Sep 2, 2010

tried NSString *about = [[NSUserDefaults standardUserDefaults] stringForKey:@"about"];

"about" is a key in my root.plist and root.inApp.plist but it just returns nil, any ideas?

I take i needs to initialize the settings?

@futuretap
Copy link
Owner

Yep, it's nil until initialized. You can create your initial userDefaults like this:

NSString* pathToUserDefaultsValues = [[NSBundle mainBundle] pathForResource:@"userDefaults" ofType:@"plist"];

NSDictionary* userDefaultsValues = [NSDictionary dictionaryWithContentsOfFile:pathToUserDefaultsValues];

[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValues];

diederich pushed a commit to cocologics/InAppSettingsKit that referenced this issue Jun 28, 2013
Look for user headers in the project folder first
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants