[launchd-dev] SMJobSubmit( ) fails but no error is returned
Karl Moskowski
kolpanic at voodooergonomics.com
Fri Jan 15 06:23:54 PST 2010
I've been trying to use SMJobSubmit( ) to have launchd run my LaunchAgent. The weird thing is, it works on my MacBook Pro at home, but on my iMac it fails - the return code is false, but the outError argument is NULL. Both machines are running up-to-date Snow Leopard and using Xcode 3.2.
Source for the app (a Sparkle utility to check all apps for updates) is at <http://bitbucket.org/kolpanic/coruscation/>. I'd appreciate any insight.
I create a NSDictionary corresponding to the plist, then submit the job with:
CFErrorRef *error = NULL;
if (!SMJobSubmit(kSMDomainUserLaunchd, (CFDictionaryRef)plist, NULL, error))
NSLog(@"Error in SMJobSubmit: %@", (NSError *)error);
if (error != NULL)
CFRelease(error);
Below is an example of the plist saved to ~/Library/LaunchAgents/. If I open Terminal and manually use launchctl to load the plist, it works.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.voodooergonomics.CoruscationAgent</string>
<key>Program</key>
<string>/Users/karl/Projects/build/Debug/Coruscation.app/Contents/MacOS/CoruscationAgent.app/Contents/MacOS/CoruscationAgent</string>
<key>RunAtLoad</key>
<false/>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>14</integer>
<key>Weekday</key>
<integer>5</integer>
</dict>
</dict>
</plist>
----
Karl Moskowski <kolpanic at voodooergonomics.com>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3692 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20100115/d0ebeb44/attachment.bin>
More information about the launchd-dev
mailing list