Launch app on boot not working with Catalina

One of my apps launches on boot. This always worked by using a helper app.
But it doesn’t work with macOS 10.15 catalina.

Anyone else having luck doing this for Catalina?
Any help would be appreciated, I cannot update my app on the AppStore anymore because of this issue.

What says Catalina Release Notes ?

Contents/Library/LoginItems?

what response do you get from SMLoginItemSetEnabled?

[quote=451737:@Christoph De Vocht]One of my apps launches on boot. This always worked by using a helper app.
But it doesn’t work with macOS 10.15 catalina.

Anyone else having luck doing this for Catalina?
Any help would be appreciated, I cannot update my app on the AppStore anymore because of this issue.[/quote]

Are you using Valdemar De SOUSA’s method ? I use it in my Char Menu app. I shall test what is going on and report.

Launch app on boot is working fine with Catalina.

[quote=451741:@Sam Rowlands]Contents/Library/LoginItems?

what response do you get from SMLoginItemSetEnabled?[/quote]

Yes, the helper app is located in the Contents/Library/LoginItems
The SMLoginItemSetEnabled returns true. The helper app is launched on boot but it does not launch the main app.
It even works fine when notarised on macOS 10.14.6 - it just doesn’t on Catalina.

This is were it goes wrong in Catalina. r is return nil on Catalina (but not on all previous macOS versions).

dim w as new NSWorkspaceMBS dim file as FolderItem file = app.BundleFolderMBS.parent.parent.parent.parent // get the main app bundle path dim error as NSErrorMBS dim configuration as new Dictionary dim options as Integer configuration.Value(w.NSWorkspaceLaunchConfigurationArchitecture) = w.NSBundleExecutableArchitectureX86_64 options = w.NSWorkspaceLaunchAndHideOthers dim r as NSRunningApplicationMBS r = w.launchApplicationAtFile(file, options, configuration, error) if r = nil then return false else return true end if

Maybe I need to codesign the helper app differently for Catalina?

Couldn’t find any info about SOUSA here. If it works, I would gladly check it out. :slight_smile:

I’m using a simple launch:

dim theParent as FolderItem = getParentApp if theParent <> Nil then theParent.Launch

where getParentApp is the 4 times parent you got, too.

[quote=451756:@Beatrix Willius]I’m using a simple launch:

dim theParent as FolderItem = getParentApp if theParent <> Nil then theParent.Launch

where getParentApp is the 4 times parent you got, too.[/quote]

Tried this but that doesn’t even work on macOS10.14 codesigned for AppStore. It only works on 10.14 when not for the AppStore.

It seems quite possible you bumped into the same issue I found of not being able to launch other apps from a Xojo app that was compiled before 2019R2.

https://forum.xojo.com/55109-f-launch-does-not-work-under-catalina

Try compiling the helper with Beta 37. It could solve the issue.

Deprecated

You should now use this instead

Oops. Sorry. I mentioned beta. Must have been tired.

Could a moderator remove my last post, and this one as well ?

Thank you.

[quote=451773:@Sam Rowlands]Deprecated
https://developer.apple.com/documentation/appkit/nsworkspace/1534810-launchapplicationaturl?language=objc

You should now use this instead
https://developer.apple.com/documentation/appkit/nsworkspace/3172700-openapplicationaturl?language=objc[/quote]

That did the trick!! Thanks, it is now working for macOS 10.15 …

Don’t forget to wrap it with [NSObject respondsToSelector:] to make sure that the replacement only gets called when it is supported, just in case Apple change their mind in the next 5 weeks.

That sounds so cynical. Or maybe just experienced …

Apple have recommended for a long time, you wrap replacement functions in a test using respondsToSelector as opposed to checking the OS version; in-case a beta function doesn’t make it into the final release. This replacement function is marked as Beta.