566Writing and Reading Preferences

Writing
CFStringRef textColorKey = CFSTR("defaultTextColor");
CFStringRef colorBLUE = CFSTR("BLUE");
CFPreferencesSetAppValue(textColorKey, colorBLUE, kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
Reading
CFStringRef textColorKey2 = CFSTR("defaultTextColor");
CFStringRef textColor;
textColor = (CFStringRef)CFPreferencesCopyAppValue(textColorKey2,kCFPreferencesCurrentApplication);
textColor must still be releasesed with CFRelease(textColor); Side note As we should know by now, CFStringRef is a toll-free bridge to NSString, meaning it’s possible to use a CFStringRef like a NSString.
NSLog(@"my CFStringRef %@", textColor);
More at Preferences Programming Topics for Core Foundation