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

后端 未结 2 1215
醉梦人生
醉梦人生 2020-12-11 05:25

I\'ve submitted a helper application (using LSUIElement)to the Mac App Store. I was under the false impression that the App Store install process would put a dock icon for h

相关标签:
2条回答
  • 2020-12-11 05:53

    Instead of using LSUIElement, use NSApplication's setActivationPolicy: method. By default, the application will have a dock icon, but by changing the activation policy to NSApplicationActivationPolicyAccessory, you get the same effect as LSUIElement while being able to change it programatically (the documentation for NSApplicationActivationPolicyAccessory says it is equivalent to LSUIElement=1).

    - (void)applicationDidFinishLaunching:(NSApplication *)app {
        if([[NSUserDefaults standardUserDefaults] boolForKey:@"HideDockIcon"])
            [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
    }
    
    0 讨论(0)
  • 2020-12-11 05:55

    Apparently I was misinformed by my app reviewer (two of them actually). The dock icon is created for you by the install process. Pressing the issue, I was able to get the app through the review process.

    0 讨论(0)
提交回复
热议问题