Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an Invisible / Hidden Cocoa Application

I want to develop a application like http://orbicule.com/undercover/ or
http://hiddenapp.com/.

I know how I could do that for windows but I have totally no clue, what kind
of approach I would need for mac os x, cocoa/xcode.

Is there anything I should be aware of when building applicatons / background services
with no GUI for mac os x?

The service will post data to the webpage with the usual data like geo location & IP
information about the machine so it should be able to access the internet too.

Please lead me to the right path.

like image 734
Herr Avatar asked Dec 17 '10 10:12

Herr


2 Answers

It's fairly straightforward.

Go to:

Information Property List Key Reference

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Introduction/Introduction.html

in the Launch Services Keys, you will see one called "LSBackgroundOnly" simply define this in your Info.plist and set it to true.

<key>LSBackgroundOnly</key>
<true/>

From the documentation:

LSBackgroundOnly (Boolean - Mac OS X) specifies whether this application runs only in the background. If this key exists and is set to “1”, Launch Services runs the application in the background only. You can use this key to create faceless background applications. You should also use this key if your application uses higher-level frameworks that connect to the window server, but are not intended to be visible to users. Background applications must be compiled as Mach-O executables. This option is not available for CFM applications.

Your application will be a background application.

like image 98
ericg Avatar answered Nov 07 '22 06:11

ericg


Give System Startup Programming Topics a read. Create a command line tool project, not a Cocoa Application nor a Cocoa Document-Based application. To provide a GUI to interface with it you'll want to use a separate application (ideally one you don't have to install with the "hidden" app, since you seem not to want it to be easily discoverable).

With the exception of AppKit (UI) stuff, the rest of the basic Cocoa frameworks is still available to you via the command line. This means you'd write the main logic of your app (the non-GUI parts) the same as you would otherwise.

like image 32
Joshua Nozzi Avatar answered Nov 07 '22 04:11

Joshua Nozzi