1

I have a settings bundle with the following settings. When I build/install my app the Settings.app appears to work correctly. I see the default value and everything. But in my app when trying to read the text field's text I get nil.

enter image description here

Here is how I read the settings

 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 NSString *temp = [defaults stringForKey:@"url_preference"];
jamone
  • 17,253
  • 17
  • 63
  • 98

1 Answers1

2

The defaults in the settings bundle are only read by the Settings app. See this question for details and workarounds.

Community
  • 1
  • 1
Jim
  • 72,985
  • 14
  • 101
  • 108
  • Thanks, sure seems like a PITA that it works this way. Perhaps it shouldn't be called DefaultValue and instead PlaceHolderValue to be inline with other iOS things. – jamone Mar 05 '11 at 21:28
  • Yeah, I think it trips up more or less everybody the first time. Definitely a badly designed API. – Jim Mar 05 '11 at 21:46