Le 15 mars 09 à 16:49, Michael Ash a écrit :

On Sun, Mar 15, 2009 at 10:36 AM, Jerry Krinock <je...@ieee.org> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to