Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App won't start at login #65

Open
Shasoosh opened this issue Sep 13, 2021 · 5 comments
Open

App won't start at login #65

Shasoosh opened this issue Sep 13, 2021 · 5 comments

Comments

@Shasoosh
Copy link

Shasoosh commented Sep 13, 2021

Created a new project with a fresh bundle id to avoid zombie instances of the app.

This is my code:

@IBAction func onBtn(_ sender: NSButton) {
        LaunchAtLogin.isEnabled = true
    }    
    
    @IBAction func offBtn(_ sender: NSButton) {
        LaunchAtLogin.isEnabled = false
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        if(LaunchAtLogin.isEnabled){
            status.stringValue = "ON"
        }
        else
        {
            status.stringValue = "OFF"
        }        
    }

I've run it in debugging mode.
I can see that isEnabled returns true even after restarting the app.
Also, running /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump will include the fresh bundle id but yet when restarting my machine, the app won't launch.

How else can I debug this?

Edit: Seems like the issue is when compiled on Xcode Version 13.0 beta 5

@flymg
Copy link

flymg commented Jan 2, 2022

I can confirm that i experience the same. The Package seems fine,
also did the following:

  • Fresh app
  • cleared Derived Data and Bin before trying
  • /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill

I also build another fresh app and added the workflow with all settings myself which is also not working with the same result.

Simply no launch after login

XCode 13.2 on BigSur 11.6.1

@Shasoosh
Copy link
Author

Shasoosh commented Jan 3, 2022

This is keeping me on Xcode 12.4.
Any update on this?

@flymg
Copy link

flymg commented Jan 3, 2022

I was able to get the mechanism to work yesterday after upgrading to macOS 11.6.2

I discovered, that SMLoginItemSetEnabled did not triggered to update
/private/var/db/com.apple.xpc.launchd/loginitems.501.plist to make the corresponding entries for App and LauncherApp.
It also did not check the return values of SMLoginItemSetEnabled, which i do now.
After upgrade of macOS the entry was written, and AutoLaunch works.

@ukushu
Copy link

ukushu commented Dec 20, 2022

MacOs: 13.1 (22C65)
Xcode: 14.2 (14C18)

App added to startup applications of MacOS

введите сюда описание изображения

but app won't start after computer restart.

App installed via TestFlight. This may be important

@tonybingo-stack
Copy link

Same problem with me .
Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants