Problem with ServiceManagementModuleMBS

Since a while I’m using ServiceManagementModuleMBS to start a helper app at log in. In a new version of my app this has stopped working. But I can’t find anything that has changed.

As usual the code is simple (without error handling):

if ServiceManagementModuleMBS.LoginItemSetEnabled(bundleID, doRegister) then dim HelperAppName as String = app.getHelperName if Right(HelperAppName, 4) <> ".app" then HelperAppName = HelperAppName + ".app" if doRegister then if ServiceManagementModuleMBS.RegisterHelperApp(HelperAppName, True) then end if end if end if

When I do a check in Terminal then everything looks okay:

launchctl list |grep com.mothsoftware.mailarchiverx
1674 0 com.mothsoftware.mailarchiverx

  • 0 com.mothsoftware.mailarchiverx.2246752

But after a restart the app isn’t loaded. I’ve tried the original example from Valdemar de Sousa and this works. I don’t see any difference to what I do. And in the new version I haven’t changed anything either.

How do I debug this problem? Lingon isn’t any help because there is no plist created.

Maybe it’S something with signatures?

Do you get a console message?
Or an error code?

I emailed you a debug plugin, so you see console messages.
Maybe an error is listed there.

Not a signature problem, the example from Valdemar works without.

Console message: nothing.

No error messages. Just no app started.

Now the really odd thing: I can’t reproduce the issue in the 2 VMs where I tested today. The laptop running Sierra still shows the issue.

Thanks for the new plugin. I’ll test that later.

I only see

Sep 1 19:03:29 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Sep 1 19:03:39 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx[836]): Could not resolve CFBundleIdentifier specified by service: -10814: com.mothsoftware.mailarchiverx
Sep 1 19:03:39 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Sep 1 19:03:49 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx[838]): Could not resolve CFBundleIdentifier specified by service: -10814: com.mothsoftware.mailarchiverx
Sep 1 19:03:49 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

in the Console, which is very very odd because the bundle id is correct.

Found some more stuff:

Sep 1 18:46:24 Beatrixs-Air Mail Archiver X[898]: MBS Debug: SMLoginItemSetEnabled 0x994bd420
Sep 1 18:46:24 Beatrixs-Air Mail Archiver X[898]: MBS Debug: i 0x11563e50
Sep 1 18:46:24 Beatrixs-Air Mail Archiver X[898]: MBS Debug: SMLoginItemSetEnabled 1
Sep 1 18:46:24 Beatrixs-Air Mail Archiver X[898]: MBS Debug: result 1
Sep 1 18:46:24 Beatrixs-Air com.apple.xpc.launchd[1] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit
Sep 1 18:46:34 Beatrixs-Air com.apple.xpc.launchd[1] (com.apple.locationmenu): Service only ran for 8 seconds. Pushing respawn out by 2 seconds.
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: SMLoginItemSetEnabled 0x994bd420
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: i 0xc0a9980
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: SMLoginItemSetEnabled 1
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: result 1
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: LSRegisterURL 0x957bf9c8
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: i 0x13ebadd0
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: mainbundle 0x2511550
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: bundleURL 0x2511200
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: loginitemsURL 0xc0a9980
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: appURL 0xc0a98d0
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: LSRegisterURL 0
Sep 1 18:46:40 Beatrixs-Air Mail Archiver X[898]: MBS Debug: result 1
Sep 1 18:46:40 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx[929]): Could not resolve CFBundleIdentifier specified by service: -10814: com.mothsoftware.mailarchiverx
Sep 1 18:46:40 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Sep 1 18:46:44 Beatrixs-Air com.apple.xpc.launchd[1] (com.apple.locationmenu): Service only ran for 8 seconds. Pushing respawn out by 2 seconds.
Sep 1 18:46:50 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx[936]): Could not resolve CFBundleIdentifier specified by service: -10814: com.mothsoftware.mailarchiverx
Sep 1 18:46:50 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Sep 1 18:47:00 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx[940]): Could not resolve CFBundleIdentifier specified by service: -10814: com.mothsoftware.mailarchiverx
Sep 1 18:47:00 Beatrixs-Air com.apple.xpc.launchd[1] (com.mothsoftware.mailarchiverx): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Sep 1 18:47:07 Beatrixs-Air App Store[275]: BUG in libdispatch client: kevent[EVFILT_MACHPORT] monitored resource vanished before the source cancel handler was invoked
Sep 1 18:47:07 Beatrixs-Air com.apple.xpc.launchd[1] (com.apple.WebKit.Networking.09CBD9D7-F024-4254-8BE7-F82A3686C6D9[434]): Service exited with abnormal c

Rebuild launch services database?

The service is not found by id.

I’ll try that. However, I’ve 3 customers at the moment with the same problem.

I’ve written a simple plist launch demon and that seems to work better.