• 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: Login item support for Panther, Tiger and Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Login item support for Panther, Tiger and Leopard


  • Subject: Re: Login item support for Panther, Tiger and Leopard
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 12 Feb 2008 10:39:27 -0800


On 2008 Feb, 11, at 21:08, Sean McBride wrote:

I use that API and CFRelease()ing the return object does not crash for
me.  You sure it's not null?

Thanks, Sean. Maybe it was. I use CF functions just often enough to forget that CFRelease(NULL) is a crasher, since I am accustomed to sending [nil release] with no trouble.


After protecting all of my CFReleases by testing for != NULL, I am able to release everything that should be released without crashes.

However, I have noticed, using
Instruments.app, that these APIs have several leaks. I suggest you file
bugs. :(


I just tried Instruments with Leaks on my little tool, but no leaks were indicated.

On 2008 Feb, 11, at 21:27, Devraj Mukherjee wrote:

This may not be an elegant solution but I had the same issue and
finally ended up resolving it using AppleScript

Yes, Devraj, using AppleScript or AppleEvents (LoginItemsAE Apple Sample Code) works, most of the time, but that is the "old way" to do it. I've found that System Events fails to respond a small percentage of the time on slower Macs, so I was trying to do it the "new way" for Leopard. Also, your code does not have the option to make an item "hidden" or not, and this is the feature that seems to be broken in the new LSSharedFileList API.


***

I still can't figure out why the "hidden" settings don't work. I've uploaded the project in case anyone wants to have a look at it. Stripped off the build so it's only 16 KB.

http://sheepsystems.com/files/SSLoginItems.zip

If I don't get any further comments, I'll just report the bug to Apple.

Jerry


*** ReadMe ***

SUMMARY

SSLoginItems.h/.c is an Obj-C wrapper on LSSharedFileList
which provides some class methods to query, add and remove
items from the user's "Login Items" in System Preferences.
These two files are in a demo project.

SSLoginItems.h/.c may be used in other projects.  Mac OS 10.5
and the CoreServices framework are required.


SYNOPSIS

+ (BOOL)isLoginItemURL:(NSURL*)url
                hidden:(NSNumber**)hidden_p
                 error:(NSError**)error_p  ;

+ (void)addLoginURL:(NSURL*)url
             hidden:(NSNumber*)hidden
              error:(NSError**)error_p ;

+ (void)removeLoginURL:(NSURL*)url
                 error:(NSError**)error_p ;


INSTRUCTIONS

Run the demo project and follow the instructions in the console.

It will examine, add and remove items from your Login Items.
It will ask you to verify the results by examining your Login Items
and then pressing return six times.


BUGS

When I run the program, I find two repeatable bugs:
  (a) Login Items that have the "Hidden" box checked are
      reported to have hidden=0.
  (b) When the tool sets a Login Item with hidden=1, the
	  "Hidden" box in Login Items does not get checked.

This looks to me like a bug in the LSSharedFileList API.
_______________________________________________

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: Login item support for Panther, Tiger and Leopard
      • From: "Sean McBride" <email@hidden>
References: 
 >Re: Fwd: Re: Login item support for Panther, Tiger and Leopard (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: Event Tap strangeness
  • Next by Date: Re: Repetitive Appending of Strings
  • Previous by thread: Re: Fwd: Re: Login item support for Panther, Tiger and Leopard
  • Next by thread: Re: Login item support for Panther, Tiger and Leopard
  • Index(es):
    • Date
    • Thread