How to make a background applications?

Discussion in 'Mac Programming' started by davbeck, May 19, 2009.

  1. davbeck macrumors regular

    Joined:
    May 16, 2008
    Location:
    Reno, NV
    #1
    How do you make an application in cocoa that does not have a dock item or a menu? I was wanting to make a utility for the NSStatusBar but could not figure out how to remove everything else from the application.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    In the Info.plist file in your project, add an LSUIElement item and set it to "1" (as a string).
     
  3. davbeck thread starter macrumors regular

    Joined:
    May 16, 2008
    Location:
    Reno, NV
  4. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #4
    I think that you don't want this as a string, but as either a BOOL, or a number. There is now a mode "2", so the number is probably the most future proof, but there are manifests that make this a bool.
     
  5. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    Where do you see documentation for this? Everywhere I've looked Apple says to use a string (and to set it to "1"), and that's what I've always used. However recently I did use the following which also worked (on Leopard):
    Code:
    <key>LSUIElement</key>
    <true/>
    So they must be checking for strings and numbers.
     
  6. davbeck thread starter macrumors regular

    Joined:
    May 16, 2008
    Location:
    Reno, NV
    #6
    In Xcode if you type in LSUIElement, it is replaced with "Application is agent (UIElement)" and changes the type to BOOL. such settings works perfectly on Leopard.
    The documentation does say string with "1" though.
     

Share This Page