SMJobBless error when Helper is already installed and running

The documentaion states that SMJobBless returns success if the service is already installed.

However, if it's installed and running, SMJobBless fails and returns a code 2 (kSMErrorInternalFailure).

I managed to evade the problem by forcing the helper to quit whenever a connection is invalidated or interrupted by stopping the main runloop. It's acceptable since in our case there shouldn't be two clients accessing the helper at the same time, but I still feel there's something wrong when calling SMJobBless and I can't put my finger on it...

Any advice on what could go wrong and what I could try to find more about it?

What problem are you trying to solve here? I never hit the issue you’ve described because I always start by trying to open a connection to the helper. I only fall into the SMJobBless path if that connection fails.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

SMJobBless error when Helper is already installed and running
 
 
Q