Re: GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?
Re: GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?
- Subject: Re: GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 15 Mar 2009 17:03:31 +0100
Le 15 mars 09 à 16:49, Michael Ash a écrit :
On Sun, Mar 15, 2009 at 10:36 AM, Jerry Krinock <email@hidden>
wrote:
Now, I understand that this design may not look good from the high
level --
for example, what if the user really needed to see that alert. But
has
anyone ever gotten into trouble by assuming that gui calls "just
won't work"
if NSApp is nil?
I don't know about people who *have* gotten into trouble, but the
*potential* for trouble with this is enormous.
For example, Apple could easily decide in 10.6 (or even 10.5.7) that
NSAlert really could do with an explicit call to NSApplicationLoad for
convenience. Now you are screwed.
Do the right thing, and don't make GUI calls if you don't want GUI
stuff.
(Note that if your command-line tool is intended to be used from
anywhere, for example from an ssh session as a different user from the
one logged in to the GUI, then you shouldn't even *link* against
AppKit in the tool, much less call it.)
Just to complete the answer, the correct way to display alert from a
background process is to use the CFUserNotification 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