Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Programmatically override NSBGOnly?

Programmatically override NSBGOnly?
Thread Tools
Mac Enthusiast
Join Date: Dec 2001
Status: Offline
Reply With Quote
Feb 5, 2003, 01:12 AM
 
So, I am writing this application (service, really) that is generally supposed to launch, run, and then quit in the background. The application has no UI and I would rather not have the icon appear in the dock and then disappear a half-second later, so I have set the NSBGOnly property to 1.

This works fine. However, when there is an error condition, I would like for the app to come to the front and present a dialog to the user. Is there any way for a faceless background app to acquire a slot in the dock and so forth while it is running?
     
Fresh-Faced Recruit
Join Date: Feb 2003
Status: Offline
Reply With Quote
Feb 5, 2003, 08:14 AM
 
not currently. you can use the CFNotification api to pop up a simple dialog box.
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Feb 5, 2003, 09:24 AM
 
Originally posted by octoberfools:
not currently. you can use the CFNotification api to pop up a simple dialog box.
I don't see any docs on Apple's website or on my hard drive for CFNotification - just CFNotificationCenter, which isn't the same thing. Is this private API? If not, could you enlighten me?

Actually, go ahead and enlighten me even if it is private.
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
nickm  (op)
Mac Enthusiast
Join Date: Dec 2001
Status: Offline
Reply With Quote
Feb 5, 2003, 12:03 PM
 
not currently. you can use the CFNotification api to pop up a simple dialog box.
Actually, the code looks like this:

[NSApp activateIgnoringOtherApps:true];
NSRunCriticalAlertPanel(NO_FILE_ERR, NO_FILE_FIX, @"OK", nil, nil);

Even when NSBGOnly is set to true in the app package it does in fact bring up a dialog that can be dismissed. However, the behavior is quirky; sometimes the dialog appears in front of the current app, sometimes not. It never appears with the focus, though. How would I use CFNotification to get the same effect as my NSRunCriticalAlertPanel call?
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Feb 7, 2003, 02:08 PM
 
Actually what he meant was CFUserNotification, not CFNotification (which is analogous to NSNotification). CFUserNotification is provided for daemons and other such things to display user alerts, as it uses the loginwindow process to actually to the display.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:45 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2