Re: Installing a new login item? - Code that works!
Re: Installing a new login item? - Code that works!
- Subject: Re: Installing a new login item? - Code that works!
- From: Pierre-Olivier Latour <email@hidden>
- Date: Wed, 03 Jul 2002 16:13:59 +0200
>
However, the code still doesn't work for me...
>
[defaults objectForKey:@"AutoLaunchedApplicationDictionary"]
>
Returns an array of 0 entries instead of 7 ones (as indicated in [defaults
>
persistentDomainForName:@"loginwindow"]).
Apparently, the CFPreference API returns an empty array if host is set to
kCFPreferencesAnyHost instead of kCFPreferencesCurrentHost.
When accessing the array through "[defaults
objectForKey:@"AutoLaunchedApplicationDictionary"]", host is very likely set
to "kCFPreferencesAnyHost" by Cocoa, therefore the incorrect (?) empty
array.
Should I report a bug for it, or is this behavior normal?
******** Code that works fine *******
NSMutableArray* loginItems;
loginItems = (NSMutableArray*) CFPreferencesCopyValue((CFStringRef)
@"AutoLaunchedApplicationDictionary", (CFStringRef) @"loginwindow",
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
loginItems = [[loginItems autorelease] mutableCopy];
//Do you stuff on "loginItems" array here
CFPreferencesSetValue((CFStringRef)
@"AutoLaunchedApplicationDictionary", loginItems, (CFStringRef)
@"loginwindow", kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFPreferencesSynchronize((CFStringRef) @"loginwindow",
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
[loginItems release];
_____________________________________________________________
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.