Hi, just recently I also dealt with setting a macOS app as a login item so that it starts automatically when the user logs in.
So do you know a suitable way to implement a login item? Here's a solution using SMLoginItemSetEnabled to set a login item.
Just follow along this tutorial, it worked fine for me and is up to date, using Swift :)
theswiftdev.com/how-to-launch-a-macos-app-at-login/
Preferably it should be installed itself when the user install the application. You will create another target inside your project, so it will be installed with your main application.
Keep in mind, that SMLoginItemSetEnabled can be tricky to test on your development computer (I'm speaking from personal experience). You should consider testing your app on a virtual machine with a fresh installation of macOS or on a different Mac, if testing on your development machine fails.
Also make sure, to place your app in the applications folder.
I hope that helps :)
Post
Replies
Boosts
Views
Activity
I have the same issue, how can we fix that?
Same issue on watchOS 10 beta. Any suggestions to solve this?
I encountered the same issue. The problem was I was running the main app but selecting the extension's scheme worked. OSlog and breakpoints worked then!
I have the same issue!
Same issue, has anyone solved this?
Same issue with Xcode 15.4 when testing on iOS 16 Simulator, iOS 17 Simulator works fine
Update: Shows on test device but simulator is still only showing the placeholder icon
Add .environment(\.symbolVariants, .none) in a tabbar to get the non-filled symbol, otherwise SwiftUI automatically chooses the filled symbol in a TabView