CookieFJ
Newbie-
Posts
3 -
Joined
-
Last visited
CookieFJ's Achievements
Newbie (1/14)
0
Reputation
-
Thank you for your answer. I got it. May I have further questions: Preference not initialize as Root.plist expected. For example, nRecent slider indicates 2 but not default 3. What will cause this? Update: looks it is set to previous value before uninstalled. So, there should be somewhere to save tweak's preference besides /var/mobile/Library/Preferences/xxxxxxx.plist or Root.plist. I made sure these 2 files do not exist before I re-install my tweak.
-
static void loadPrefs() { NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.youcompany.tweakprefs.plist"]; isEnabled = ( [settings objectForKey:@"isEnabled"] ? [[settings objectForKey:@"isEnabled"] boolValue] : isEnabled ); isRecent = ( [settings objectForKey:@"isRecent"] ? [[settings objectForKey:@"isRecent"] boolValue] : isRecent ); nRecent = ( [settings objectForKey:@"nRecent"] ? [[settings objectForKey:@"nRecent"] intValue] : nRecent ); } %ctor { loadPrefs(); CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.youcompany.tweakprefs.prefschanged"), NULL, CFNotificationSuspensionBehaviorCoalesce); } <?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>items</key> <array> <dict> <key>cell</key> <string>PSGroupCell</string> <key>footerText</key> <string>turn on to make this tweak function</string> </dict> <dict> <key>cell</key> <string>PSSwitchCell</string> <key>default</key> <false/> <key>defaults</key> <string>com.yourcompany.tweakprefs</string> <key>key</key> <string>isEnabled</string> <key>label</key> <string>Enable</string> </dict> <dict> <key>cell</key> <string>PSGroupCell</string> <key>footerText</key> <string>Options</string> <dict> <key>cell</key> <string>PSSwitchCell</string> <key>default</key> <true/> <key>defaults</key> <string>com.youcompany.tweakprefs</string> <key>PostNotification</key> <string>com.youcompany.tweakprefs.prefschanged</string> <key>key</key> <string>isRecent</string> <key>label</key> <string>Show Recent</string> </dict> <dict> <key>cell</key> <string>PSTextCell</string> <key>label</key> <string>Recent Number </string> </dict> <dict> <key>cell</key> <string>PSSliderCell</string> <key>defaults</key> <string>com.youcompany.tweakprefs</string> <key>default</key> <integer>3</integer> <key>min</key> <integer>1</integer> <key>max</key> <integer>5</integer> <key>isSegmented</key> <true/> <key>segmentCount</key> <integer>4</integer> <key>showValue</key> <true/> <key>key</key> <string>nRecent</string> </dict> </array> <key>title</key> <string>Tweak Setting</string> </dict> </plist>
-
Thanks for the preference template. Just noted that the initialization not correct as I expected. value not same as in Root.plist. looks like random value. in %ctor, tried to fetch the value from /var/mobile/Library/Preferences/tweakid.plist, but failed since I can't find the plist file in Filza. After do some setting in tweak setting, the plist file was created. Then the values are synced up with setting. Question: who and when will create preference bundle file? Thanks.