Thanks for getting back to me.
Here is some info about the plist and the app.
It feels like I am missing something obvious...bob
I have been running a cocoa-app with a simple gui two different ways.
1. Run from a script file at the cmd-line.
This runs fine. I check various fields by tailing the system.log.
The alert panels appear as I expect.
2. Run by the same script file, which is run by launchd.
The app is recognized and starts up.
I can see the same fields in the tailed system log.
The app run ok until it hangs in the call to [oAlert runModal];
I also try to run the app directly from launchd.
I get the same effect as in #2 above.
Here is the launchd plist.
It is located in ~/Library/LaunchAgents.
I cd here to issue all the launchctl calls.
I have tried various permutations, such as the full path in the Program-key value.
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>Label</key>
<string>net.aquaconnect.acnotify</string>
<key>OnDemand</key>
<true/>
<key>Program</key>
<string>ACNotify</string>
<key>ProgramArguments</key>
<array>
<string>/Users/bob/AppSupport/ACNotify.app/Contents/MacOS/ACNotify</string>
<string>-d</string>
<string>4</string>
<string>-p</string>
<string>/Users/bob/LaunchScriptTest</string>
</array>
<key>QueueDirectories</key>
<array>
<string>/Users/bob/LaunchScriptTest</string>
</array>
<key>ServiceDescription</key>
<string>Aquaconnect Alert Notification Manager</string>
<key>WorkingDirectory</key>
<string>/Users/bob/AppSupport/ACNotify.app/Contents/MacOS</string>
</dict>
</plist>
Here are code snippets of the app being called.
This lists all of the gui-related calls in the app.
I have a custom object instantiated in IB, and connected to File's Owner for
some delegate methods.
Again, I have tried various permutation...
Creating NSAlert via the init/alloc; removed the NSPanel calls.
Have added LSUIElement-key with a value of 1 to the Info.plist of the xcode project.
I did have retain/releases with the NSAlert, but removed them as the
doc says it is autoreleased.
// ----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
// ----------------------------------------------------------------------------
- (void) applicationDidFinishLaunching: (NSNotification *) aNotification
// set focus to NSApp (forces its windows on top of all other windows)
[NSApp activateIgnoringOtherApps: YES];
// ----------------------------------------------------------------
// create NSAlert object
oAlert = [NSAlert alertWithMessageText: msgTitle defaultButton: b1Title
alternateButton: nil
otherButton: nil
informativeTextWithFormat: msgInfo];
[oAlert setAlertStyle: NSWarningAlertStyle];
oPanel = [oAlert window];
[oPanel orderFront: self];
*****HERE IS WHERE THE CODE HANGS*****
iButton = [oAlert runModal];
[NSApp terminate: self];
// ----------------------------------------------------------------------------
- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) mApp
return (NSTerminateNow);
// ----------------------------------------------------------------------------
- (void) applicationWillTerminate: (NSNotification *) aNotification
application cleanup
On Dec 14, 2007, at 3:30 PM, James Bucanek wrote:
Not having any luck running a LaunchAgent containing a gui from launchd.
Is this simply not possible?
I'm running both GUI and non-GUI agents (~/Library/LaunchAgents) using launchd.
Try telling us what your .plist contains and describe the problems your having.
--
James Bucanek