Hello ! Every one here.
I am facing a problem in accessing Settings.bundle.
Let me explain what exactly I am doing.
- Any kind of new Project Template from File ( Under iPhone OS ) - preferable View based.
- Now Right click on your project / Resources group.
- Select Add / New File
- Under iPhone Os - resource - Settings Bundle.
- Name it as strictly "Settings.bundle"
Now The very important steps.
- Expand Settings.bundle in your project.
- Click on Root.plist
- In Editor - Expand Preference Specifiers
- Remove Item 2, Item 3, Item 4
- Select Item 1 & copy & Past it.
- Edit Item 2' type ( Item 1's copy )
- Set PSChildPaneSpecifier as type ( of item'2 )
- Set Title as you wish.
- Add a new Key value pair to this ( item 2 ) dictionary.
- Set Key = "File" & String = "FontSettings"
Now In above steps, I have specified " I need a child pane for settings " & Child Pane settings will be loaded from FontSettings.plist
Ok. Further Steps.
- Now, Right click on your Settings.bundle / en.lproj ( Just because we need to add another plist file under settings.bundle.
- Add / New File - Under Mac OS x - Choose Other -> Property List
- Name as FontSettings.plist
For just verification that settings.bundle contains that file or not.
- Open your project in finder.
- Right click on Settings.bundle
- Click on show package contents.
- If it shows FontSettings.plist in package contents, Then it's perfect till now.
Now, For FontSettings.plist
- Open Root.plist under settings.bundle.
- Copy Stringtable, PreferenceSpecifiers to the FontSettings.plist
- Now in FontSettings.plist - Add settings as you wish.
Check in simulator.
- Run program & tap on button. ( To terminate app. )
- Go to settings.
- Open Your Project Settings
- You can go to child pane.
Till now, I believe I have followed the correct steps.
The problem that I am facing is here now.
If there is just a single Root.plist, we can directly access
[[NSUserDefaults standardUserDefaults] stringForKey:@"fName"]
Like above.
But the question is "How to access - child pane settings ? "
I have tried following way
NSString *str=[[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
NSString *path=[str stringByAppendingPathComponent:@"FontSettings.plist"];
NSDictionary *dFor=[NSDictionary dictionaryWithContentsOfFile:path];
But the problem in above code is "It's just giving me the same default value every time, even after - changing the values from settings of iPhone - settings.
What should I do for Accessing Child.plist settings? ( that user has set )
Thanks in advance for sharing your knowledge.
Sagar.