简体   繁体   中英

How can I reuse a plist file with InAppSettingsKit?

When using InAppSettingsKit , I see a few ways that different plist files are used, 1) when using a childpane or 2) when using a list.

I want to be able to reuse a plist file but have the keys for the different settings be different. This would allow me to reuse the same file but have different settings stored. ie. something like: CommonSettings.plist :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>Type</key>
            <string>PSMultiValueSpecifier</string>
            <key>Title</key>
            <string>A_COMMON_SETTING</string>
            <key>Key</key>
            <string>${unique}_setting_value</string>
            <key>DefaultValue</key>
            <integer>1</integer>
        </dict>
    </array>
</dict>
</plist>

Note: I'm already taking the values/titles using the valuesFor and titlesFor delegate methods for the PSMultiValueSpecifier .

One way I though about doing this was using the list functionality without an Add capability but that didn't work since the AddSpecifier seems required even though the documentation states:

Optionally, a list group also has an AddSpecifier

(My program crashed without it)

Note: I did take a look at this question but I'm already comfortable using different plist files, I'm looking to reuse them.

IASK doesn't support a dynamic variable resolution in plists. However, you should be able to achieve this with a custom build script that generates the different plist files at compile time from one master file with variable replacement. Use /usr/libexec/PlistBuddy to work with plist files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM