• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Notification on Login Items change?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification on Login Items change?


  • Subject: Re: Notification on Login Items change?
  • From: Karl Moskowski <email@hidden>
  • Date: Fri, 17 Oct 2008 16:14:51 -0400

Thanks to Nick, I've started looking at the LSSharedFileList observation methods. However, it's still not working correctly.

First, In my class' init method, I added an observer:
LSSharedFileListRef list = LSSharedFileListCreate(kCFAllocatorDefault, kLSSharedFileListSessionLoginItems, nil);
LSSharedFileListAddObserver(list, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, &LoginItemsListChanged, nil);
if (list) CFRelease(list);


Then I added the callback method (per the prototype in the .h):
static void LoginItemsListChanged(LSSharedFileListRef inList, void *context) {
NSLog(@"login items changed");
}


Now, when I add & remove an app to the Login Items in System Prefs, the callback method gets called once for each of N items in the list (instead of once), and the inList argument is invalid - it seems to contain N invalid items. If I try to snapshot the list to an array (in which to look for my app), it contains N nil objects.
UInt32 seed;
CFArrayRef loginItems = LSSharedFileListCopySnapshot(list, &seed);


Any ideas, anyone? Thanks.

----
Karl Moskowski <email@hidden>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Notification on Login Items change?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Delete myDriver.kext files from normal user.
  • Next by Date: Re: Delete myDriver.kext files from normal user.
  • Previous by thread: Re: Notification on Login Items change?
  • Next by thread: Re: Notification on Login Items change?
  • Index(es):
    • Date
    • Thread