Several applications in one kit

I am developing a multi-platform presentation application with two parts: an editor part and a viewer part. Both parts are developed as separate programs. The user edits individual slides with the editor, and the editor launches the viewer whenever the user wants to see his presentation.

On Windows, the editor can simply launch the viewer by executing the ShellExecute () command. On Linux systems, the editor might just fork (), but on Mac OS X it looks like it might get complicated by the concept of an infamous application.

I am wondering how this problem should be solved on Mac OS X.

Is it possible to have multiple apps inside one app bundle, or keep the editor and viewer files as separate app bundles?

Also, how should I pass information from the editor to the viewer application? that is, the viewer must know which file should be shown. On Windows and Linux, I can just pass this as command line arguments to the WinMain () or main () function. On OS X it looks like LSOpenApplication () can do the job, but this is now deprecated. And I don't know if LSOpenApplication () can open applications inside the same application, because I don't know if this is possible ...

Can someone shed some light on this topic? Thank!

+3


source to share


1 answer


Is it possible to have multiple apps inside one app bundle, or keep the editor and viewer files as separate app bundles?

Yes and yes.

Each application should be its own package. But you can include bundles inside your packages. It's not even that rare. Take a look inside iTunes, for example:



/Applications/iTunes.app/Contents/MacOS$ ls -l
total 116816
-rwxr-xr-x  1 root  wheel  56643216 Oct 15 09:29 iTunes
-rwxr-xr-x  1 root  wheel     42608 Oct 16 20:31 iTunesASUHelper
drwxr-xr-x  3 root  wheel       102 Oct 16 20:33 iTunesHelper.app
-rw-r--r--  1 root  wheel   3617952 Oct 16 20:31 libgnsdk_dsp.3.06.0.dylib
-rw-r--r--  1 root  wheel    328928 Oct 16 20:31 libgnsdk_link.3.06.0.dylib
-rw-r--r--  1 root  wheel   3831312 Oct 16 20:31 libgnsdk_manager.3.06.0.dylib
-rw-r--r--  1 root  wheel   1511792 Oct 16 20:31 libgnsdk_musicid.3.06.0.dylib
-rw-r--r--  1 root  wheel    655328 Oct 16 20:31 libgnsdk_submit.3.06.0.dylib

      

See how it iTunesHelper.app

lives inside iTunes.app

? And also the command line tool iTunesASUHelper? This is normal and normal. Just move it there during the build step of the copy files.

The common tool for launching applications is now NSWorkspace

. For your specific case, you probably want to openFile:withApplication:

. However, you can also take a look at the XPC to make sure it better suits your needs. This makes communication between processes much easier, although I find it best for helper services rather than full-fledged GUI applications.

+6


source







All Articles