How to create a helper application (LSUIElement) that also has a (removable) dock icon

I introduced a helper application (using LSUIElement) on the Mac App Store. I was under the false impression that the App Store installation process installed a dock icon for auxiliary applications.

How to create a dock icon that a user can remove while the status bar application is working independently (for example, the popular Caffeine application)? Do I need to create an application without LSUIElement that loads the LSUIElement application, or is there a better way?

+6
osx-snow-leopard statusbar macos mac-app-store
Mar 21 '11 at 20:00
source share
2 answers

Apparently, I was misinformed by my app reviewer (two of them actually). Dock icon Created for you by the installation process. By tackling this issue, I was able to get the application in the review process.

+1
Mar 24 2018-11-11T00:
source share

Instead of using LSUIElement, use the NSApplication setActivationPolicy: method. By default, the application will have a dock icon, but NSApplicationActivationPolicyAccessory you change the activation policy to NSApplicationActivationPolicyAccessory , you will get the same effect as LSUIElement when you can change it programmatically (the documentation for NSApplicationActivationPolicyAccessory says that it is equivalent to LSUIElement = 1).

 - (void)applicationDidFinishLaunching:(NSApplication *)app { if([[NSUserDefaults standardUserDefaults] boolForKey:@"HideDockIcon"]) [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory]; } 
+18
Mar 21 '11 at 22:05
source share



All Articles