Question

i made an App that was submitted to the Mac AppStore. For some reasons, they refused it, because it was installing a helper tool using the SMJobBless API.

As this helper tool isn't necessary for most of the App's functionality, i have removed it, and my application got accepted.

So right now, i am packaging a standalone installer for the helper tool that would be downloadable on the internet.

However, after i have installed the files in place, the helper tool refuses to run... The helper tool just has a plist that goes into /Library/LaunchDaemons and a binary that goes into /Library/PrivilegedHelperTools.

Now i'm wondering, what exactly is SMJobBless doing more than moving files into place? Is it registering my tool with launchctl? i tried various things, to manually add it to launchctl, without success: the helper tool just exits after requesting it's checkin request.

The helper tool just contains that:

@autoreleasepool {
    launch_data_t       req             = launch_data_new_string(LAUNCH_KEY_CHECKIN);
    launch_data_t       resp            = launch_msg(req); // AT THIS POINT, RESP IS NULL. Why?
    launch_data_t       machData        = launch_data_dict_lookup(resp, LAUNCH_JOBKEY_MACHSERVICES);
    launch_data_t       machPData       = launch_data_dict_lookup(machData, [kHelperBundleName UTF8String]);
    mach_port_t         mp              = launch_data_get_machport(machPData);
    launch_data_free                    (resp);
    launch_data_free                    (req);
    // Prepare connexion.
    NSMachPort          *rp             = [[NSMachPort alloc] initWithMachPort:mp];
    PrivilegedHelperProxy
                        *phProxy        = [[[PrivilegedHelperProxy alloc] init] autorelease];
    NSConnection        *con            = [NSConnection connectionWithReceivePort:rp sendPort:nil];
    [rp release];
    [con setRootObject:phProxy];
    [[NSRunLoop currentRunLoop] run];
}
return                                  EXIT_SUCCESS;

This service was running flawlessly when getting installed via the SMJobBless API, and the root proxy was accessible from within my APP...

So what would be the required steps for my installer to get this helper tool properly working, as it would with calls to the SMJobBless API?

Thanks, Pierre.

Was it helpful?

Solution

Solved. The PList entry for the helper tool wasn't including any ProgramArguments (This didn't seem to be an issue with the SMJobBless API). After adding those to the PList, the helper tool can correctly run, and the installer registers it correctly.

Thanks anyways! Pierre.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top