Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i modify Root.plist in settings bundle dynamically?

Tags:

I have a settings bundle in my app.. containing root.plist now i have a screen which contains a checkbox.. on pressing the check box i want to change the BOOL value for DefaultValue key of PSToggleSwitchSpecifier in the plist. Since its being done at runtime.. my question is that .. can the file be changed at runtime and if yes.. give an idea how to do it??

here is the plist:

    <plist version="1.0">
<dict>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>DefaultValue</key>
            <string></string>
            <key>Key</key>
            <string>Username</string>
            <key>Title</key>
            <string>Username</string>
            <key>Type</key>
            <string>PSTextFieldSpecifier</string>
        </dict>
        <dict>
            <key>DefaultValue</key>
            <string></string>
            <key>IsSecure</key>
            <true/>
            <key>Key</key>
            <string>Password</string>
            <key>Title</key>
            <string>Password</string>
            <key>Type</key>
            <string>PSTextFieldSpecifier</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSToggleSwitchSpecifier</string>    <-----toggleSwitch
            <key>Title</key>
            <string>Remember</string>
            <key>Key</key>
            <string>CheckBox</string>
            <key>DefaultValue</key>    <----- Default Value
            <false/>                   <---- want to change this value 
        </dict>
    </array>
    <key>Title</key>
    <string>Settings</string>
</dict>
</plist>

thank you in advance ;)