Launch app on boot not working with Catalina

  1. 4 weeks ago

    Christoph D

    Aug 25 Pre-Release Testers, Xojo Pro

    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.

  2. Emile S

    Aug 25 Europe (France, Strasbourg)

    What says Catalina Release Notes ?

  3. Sam R

    Aug 25 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan
    Edited 4 weeks ago

    @Christoph Dnbsp;Vocht Any help would be appreciated, I cannot update my app on the AppStore anymore because of this issue.

    Contents/Library/LoginItems?

    what response do you get from SMLoginItemSetEnabled?

  4. Michel B

    Aug 25 Pre-Release Testers, Xojo Pro RubberViews.com

    @Christoph Dnbsp;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.

    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.

  5. Beatrix W

    Aug 25 Pre-Release Testers, Third Party Store Europe (Germany)

    Launch app on boot is working fine with Catalina.

  6. Christoph D

    Aug 25 Pre-Release Testers, Xojo Pro
    Edited 4 weeks ago

    @Sam R Contents/Library/LoginItems?

    what response do you get from SMLoginItemSetEnabled?

    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?

  7. Christoph D

    Aug 25 Pre-Release Testers, Xojo Pro
    Edited 4 weeks ago

    @Michel B 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.

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

  8. Beatrix W

    Aug 25 Pre-Release Testers, Third Party Store Europe (Germany)

    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.

  9. Christoph D

    Aug 25 Pre-Release Testers, Xojo Pro

    @Beatrix W 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.

    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.

  10. Michel B

    Aug 25 Pre-Release Testers, Xojo Pro RubberViews.com
    Edited 4 weeks ago

    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.

  11. Sam R

    Aug 25 Pre-Release Testers, Xojo Pro, Third Party Store Answer Hengchun, Pingtung, Taiwan

    @Christoph De Vocht r = w.launchApplicationAtFile(file, options, configuration, error)

    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

  12. Michel B

    Aug 25 Pre-Release Testers, Xojo Pro RubberViews.com
    Edited 4 weeks ago

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

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

    Thank you.

  13. Christoph D

    Aug 26 Pre-Release Testers, Xojo Pro

    @Sam R 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

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

  14. Sam R

    Aug 26 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    @Christoph De Vocht 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.

  15. Douglas H

    Aug 26 Pre-Release Testers, Xojo Pro

    @Sam R 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 ...

  16. Sam R

    Aug 27 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    @Douglas H 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.

or Sign Up to reply!