App won't start at login
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
I can confirm that i experience the same. The Package seems fine, also did the following:
- Fresh app
- cleared
Derived DataandBinbefore 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
This is keeping me on Xcode 12.4. Any update on this?
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.
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
Same problem with me . Any ideas?
