开发者

How to read settings from NSUserDefaults when using inappsettingskit

I am new to XCode and iOS programming. So please assume nothing ...

I am trying to incorporate the inappsettings bundle into my project. It is the 3rd party product found at http://inappsettingskit.com/

I have included all (I think) the files from the kit as well as their settings.app bundle. Through IB, I have built a tab bar where each tab item is a navigational controller. The view of my "Settings" tab is a view controller of class IASKAppSettingsViewController.

When I run my app, the default setting screen included in the kit displays and everything seems to run correctly.

However, I cannot figure out how to actually use the settings that I select in my app. I believe that the settings are stored in [NSUserDefaults standardUserDefaults], but when I query this as below, NSString* s always comes back as nil.

NSUserDefaults* d = [NSUserDefaults standardUserDefaults];

NSString* s = [d objectForKey:@"ROOKIE"];

I have also tried initializing [[NSUserDefaults standardUserDefaults] as follows:

[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Root~iphone.InApp" ofType:@"plist"]]];

I have added the key "ROOKIE" to the Root~iphone.InApp.plist file incl开发者_Python百科uded in the Settings bundles. I put "ROOKIE" in the "key" column and some string value in the "value" column.

Maybe here is where I am doing something wrong? I don't really understand how the .plist files work and if I am accessing the correct one, or if I am doing it in the right way. I have played around and I can't seem to extract any value from any .plist file so it would seem it's my approach rather than the file?

Any insight would be appreciated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜