SMJobSubmit( ) fails but no error is returned
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@voodooergonomics.com> Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
On Jan 15, 2010, at 6:23 AM, Karl Moskowski wrote:
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);
Is there anything logged to the system log? -- Damien Sorresso BSD Engineering Apple Inc.
On 2010-01-15, at 1:34 PM, Damien Sorresso wrote:
Is there anything logged to the system log?
Just my own logging of the error: 10-01-15 9:14:27 AM Coruscation[3163] Error in SMJobSubmit: (null) ---- Karl Moskowski <kolpanic@voodooergonomics.com> Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
participants (2)
-
Damien Sorresso
-
Karl Moskowski