 |
 |
Programmatically override NSBGOnly?
|
 |
|
 |
|
Mac Enthusiast
Join Date: Dec 2001
Status:
Offline
|
|
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
|
|
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
|
|
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.
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Dec 2001
Status:
Offline
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|