IPhone App Settings: Settings.bundle vs plist file? - iphone

I'm a bit confused. I'd like to implement some simple settings for my app. I was thinking of just creating a simple plist file. But now I see that there's something called "Settings.bundle" (that also has a plist in there but some other stuff too).
What I'm wondering, which one should I use? (I'm looking for the easiest way)
Thanks!!

I would suggest looking into NSUserDefaults to store basic app settings.

The settings bundle is for having settings that show up in the system Settings.app. You can use a plist (or easier, NSUserDefaults, which handles the plist for you) to store settings that you change within the app itself.

See the Displaying Application Settings section in the iOS Application Programming Guide.

Related

iOS Import settings into app from file

I know it's possible to make your app open files by changing the info.plist in xcode
Is it possible to have your app open for example a .properties file, which is a plist containing personal user settings i.e. a login username and password, and get your app to read and import this?
Yes you can.
Your iOS app can handle some file extension you want to, but take care about the security issue!
Take a look to this tutorial:
http://www.raywenderlich.com/1980/how-to-import-and-export-app-data-via-email-in-your-ios-app
You can always read a plist file and import them, provided the plist is part of your app's sandbox. If you want to have settings and preferences, you can prefer settings bundle which also is a plist file.

App settings in iPhone Settings

I have been reading and exploring around adding settings for custom apps in the iPhone settings page.
And there is a question that is arising in my mind that, can we point an XIB / UIStoryboard-viewController which is designed by us into the root.plist.
This can help in displaying custom design and handling things differently as required.
For example, if custom app uses the passcode protection then we will need to save the passcode into the keychain and that will require additional logic to be written.
Cheers,
Kunjal
You cannot use custom UIViewControllers in the iOS settings page for your app. When using the Settings.bundle the preferences are stored in NSUserDefaults which does not integrate with the keychain. So you will need to include the settings view for the passcode in the app itself.

App Settings change: 2 synchronizes for StandardUserDefaults necessary?

I am changing app settings within my iPhone application.
Strangely, I have to do 2 synchronize commands with StandardUserDefaults to make my changes to be reflected in the app settings.
Secondly, when I change my "preferred user language" within my iPhone application, I do have to start my app twice for the language change.
What's the reason for that?
Is there a way to dump the StandardUserDefaults and to see all the settings stored there?
Thanks for your help!
Is there a way to dump the StandardUserDefaults and to see all the settings stored there?
Yes, that is pretty easy to do.
The NSUserDefaults are stored in a plist file located in your app's sandboxed environment inside the Library folder.
For checking this on the simulator, have a look at
~/Library/Application Support/iPhone
Simulator/5.0/Applications/[hashed app
identifier]/Library/Preferences/[application bundle identifier].plist
Note that you will have to replace the values in brackets to find your specific app. Also note that this path works for the iOS5.0 environment - for others, you will have to replace the 5.0 with whatever system version you are working with.

Iphone - NSUserDefault settings do not appear on the settings page

I am an iOS development newbie. I am implementing some sample code, but try as I might I do not see my NSUserDefault settings on the settings page. What needs to be done for that? Also, where do you specify the UI for the settings page?
You need to define your settings bundle, see http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/Preferences/Preferences.html

Display iphone application settings within your application

The iphone supports a means of defining your application's settings such that it will automatically create a UI in the Settings app. I want to also allow the user to edit the application settings within the application but it'd be nice to reuse the same UI that is automatically created.
See: Application Settings
Is there a way to have your application display the settings using the same UI that the Settings application does?
No there is not a way to reuse the UI.
There is, however, a way to reuse the data. Settings.app will put the settings in NSUserDefaults under the keys specified in your Settings.bundle plist file. You can alter those values in your app, then switch to Settings.app and see that it will have changed to reflect your new values. This is really nice if you want to allow the user to edit settings in the app (if that's what they're used to) or in Settings.app (if that's what they're used to).
EDIT #1
You may want to look at this thread. There is a library called mySettings that would make building this easier.
EDIT #2
There are a couple libraries available now that do this:
InAppSettings
InAppSettingsKit