Re: Installing a new login item?
Re: Installing a new login item?
- Subject: Re: Installing a new login item?
- From: Pierre-Olivier Latour <email@hidden>
- Date: Tue, 02 Jul 2002 20:10:23 +0200
>
Use the CFPreferences API to access the 'AutoLaunchedApplicationDictionary'
>
item within the 'loginwindow' domain (identifier).
>
>
With that API, you can retrieve that preference directly as a property
>
list as a CFArray. A CFArray can be transparently typecast to an NSArray.
>
So:
>
>
... retrieve default via CFPreferences ...
>
>
NSMutableArray *moddedPrefs = [...retrieved default... mutableCopy];
>
... add your NSDictionary intstance here ...
>
>
... write moddedPrefs back to defaults database via CFPreferences ...
>
>
Make sure to call the preferences synchronization function to force the
>
prefs to be written to disk.
How about using NSUserDefaults like Matt said? I tried this:
NSUserDefaults* defaults = [[NSUserDefaults alloc] init];
[defaults addSuiteNamed:@"loginwindow"];
NSLog(@"OUT: %@", [defaults persistentDomainForName:@"loginwindow"]);
NSLog(@"OUT: %@", [defaults
objectForKey:@"AutoLaunchedApplicationDictionary"]);
This is weird because first output returns the complete content of the
"loginwindow.plist" file, but the second one displays:
<CFArray 0x86880 [0x8016024c]>{type = immutable, count = 0, values = (
)}
Which is incorrect because this array should actually contain 5 items (and
the array is correctly displayed in the first output).
Any idea?
_____________________________________________________________
Pierre-Olivier Latour email@hidden
Manager and Lead Programmer
French Touch software
http://www.french-touch.net
Cool source code:
http://www.french-touch.net/CodeWareHouse
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.