Wednesday, August 3, 2011

How to add Setting bundle to your app ?

So you want to have the setting page of your app in device's Setting. Looking something like following :

You add new file to your app of type Setting Bundle.
To add new file : Right Click on your project on left pane in XCode, Select Add new file. It will open a new window just select Resource and you will see following window: (Select Settings Bundle in this window and Click next)

You will be able to see Settings folder in your project in Xcode as shown in the screenshot below.

You can view Root.plist as ASCII property list or source code.

ASCII property list

Source Code

As you can see in Source Code... for every item in ASCII Property List(item 0, item 1 etc), there exists a dictionary in Source Code version. You can delete or add more dictionaries..according to your need.

It is the key of one of the items in this case. You can fetch value of items stored in the dictionary as following

       NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *hostURL = [[defaults stringForKey:@"hostname"] retain];


  1. please share code :/
    i use keychainwrapper for save to session.
    i put ip and port in preferences. but i cant use it.