Take a look at this older tutorial. (Note: for others reading this, the tutorial does not use PreferenceLoader, which should now be used for this task)
In your case, I think the MyAppName.plist
should contain something like this:
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSLinkListCell</string>
<key>defaults</key>
<string>com.mycompany.MyAppName</string>
<key>detail</key>
<string>PSListItemsController</string>
<key>key</key>
<string>color_pref</string>
<key>label</key>
<string>Color</string>
<key>validTitles</key>
<array>
<string>Blue</string>
<string>Yellow</string>
<string>Green</string>
</array>
<key>validValues</key>
<array>
<string>Blue</string>
<string>Yellow</string>
<string>Green</string>
</array>
</dict>
</array>
Which could then be read in by your code like this:
#define PLIST_FILENAME @"/var/mobile/Library/Preferences/com.mycompany.MyAppName.plist"
#define COLOR_PREF @"color_pref"
// an ivar
NSMutableDictionary* preferences;
- (void) initializePreferences {
NSFileManager* fileManager = [NSFileManager defaultManager];
// initialize the preferences
if (![fileManager fileExistsAtPath: PLIST_FILENAME]) {
// make sure the user settings have default values assigned
NSDictionary* defaultPrefs = [[NSDictionary alloc] initWithObjectsAndKeys:
@"Yellow", COLOR_PREF,
nil];
preferences = [[NSMutableDictionary alloc] initWithDictionary: defaultPrefs];
[preferences writeToFile: PLIST_FILENAME atomically: YES];
} else {
preferences = [[NSMutableDictionary alloc] initWithContentsOfFile: PLIST_FILENAME];
}
}
- (NSString*) colorPref {
return [preferences valueForKey: COLOR_PREF];
}
I've skipped over some steps here, as it sounds like you're familiar with the general process of adding your jailbreak app, or tweak's, settings to Preferences.app. If this doesn't work for you, post a comment asking for clarification.