4

Is there any way to set/update values in the settings.bundle from within your app. I am fine reading in values from the preferences into NSUserDefaults but was wondering whether you can set values from within the app.

I have a web-app which I am making a iPhone client for and was thinking to include the users account details in the settings.bundle. This is fine if the user only updates the values through the Apple Application Preferences screens, but what if the user updated those values in the web app. I wanted to pull down the values from the web and then "update" the values in the settings.bundle from within the App.

I am guessing that this is not possible and that maybe I need to create my own "in-app" settings screen? But thought I would check with you all first ...

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
joneswah
  • 2,788
  • 3
  • 33
  • 32

1 Answers1

7

You're asking two questions here.

The first one is if you can update settings from within the application. You assume you can't, but you can quite easily. Just use NSUserDefault's setObject:forKey: method.

If you want to do in-app settings, I'd start here: How to simplify in app Application Settings management?

Community
  • 1
  • 1
Steven Fisher
  • 44,462
  • 20
  • 138
  • 192
  • perfect thanks, simple when you know how... for some stupid reason I thought NSUserDefaults was "read-only". I now see that the setting bundle is a mechanism to define the structure and set some defaults. NSUserDefaults provides the power thx again – joneswah Mar 27 '10 at 08:55
  • You can store things that don't fit into the settings app there, too. I mean, keep it to some reasonable limit, but a few things (username, password) make sense. – Steven Fisher Mar 30 '10 at 07:08
  • 1
    When you set some object to NSUserDefaults's, does it reflect in Settings bundle (iPhone Settings -> Applications)? – Satyam Dec 07 '10 at 17:23
  • Yes. (I know I'm horribly late to that, but I didn't see it before today.) – Steven Fisher Feb 24 '12 at 07:08