开发者

How do I use a default setting from Root.plist?

I have set up a default setting for my app using Root.plist, giving this a Boolean DefaultValue of YES (ticked checkbox).You can see a screengrab at http://www.infin8design.com/clients/stack/plist.png

However, when my app is first launched, the YES value is not picked up, and the setting is read as a NO (or 0). The user has to manually go into the settings app, turn the toggleswitch off, then turn it back on again for this setting to hold a YES(1) value.

I'm logging the value with appDidFinishLaunching like this.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 


NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"%d",[defaults boolForKey开发者_高级运维:@"include_phrases"]);

SO... my question is... How do I pick up this initial default setting without the user having to set it manually?

Thanks in advance for any suggestions you can offer.

Mark


looks like you need to set the values that you want the key to take when the user switches the parameter on and off. Try adding the following to your plist:

TrueValue   String  YES
FalseValue  String  NO
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜