I am trying to get the value of the repeatInterval key in pl. com.apple.scheduler. I would just like to use the NSDictionary valueForKeyPath: method like this:
CFPropertyListRef value;
value = CFPreferencesCopyValue(CFSTR("AbsoluteSchedule"),
CFSTR("com.apple.scheduler"),
kCFPreferencesCurrentUser,
kCFPreferencesCurrentHost);
NSNumber *repeatInterval = [(NSDictionary *)value valueForKeyPath:@"com.apple.SoftwareUpdate.SUCheckSchedulerTag.Timer.repeatInterval"];
But the problem is that the first key is really "com.apple.SoftwareUpdate", not just "com". I can get around this by getting this first value separately:
NSDictionary *dict = [(NSDictionary *)value valueForKey:@"com.apple.SoftwareUpdate"];
NSNumber *repeatInterval = [dict valueForKeyPath:@"SUCheckSchedulerTag.Timer.repeatInterval"];
I just wanted to know if there is a way to avoid periods in the path to the keys, so I can eliminate this extra step.
source
share