info.plist in ServiceApplication

Hi…

When I build a ServiceApplication there is no “app package”… instead I get a “unix executable” along with a “Libs” and “Resources” folder.

But when I dig through those folders, I do not find a “info.plist” like I do in the contents of a desktop app.

Is the content of the info.plist buried inside some file… is none create? What do I do if I need to modify “NSAppTransportSecurity”?

Thanks for any insight,
Jim

That’s a good question. I found a blog post that seems to indicate that you have to tell the linker to embed the Info.plist into the app (scroll down to “Embedding Info.plist”). If that’s the case, it seems like we’d need to change something on our end to give you that capability, so a Feedback case would be in order.

https://red-sweater.com/blog/2083/the-power-of-plist

Paul… thanks for the reply… Feedback: 54700

Jim

ServiceApplication is for Windows only — for macOS and Linux you need to make it a ConsoleApplication.

I learn something new every day… Based on the current documentation you are correct… but I have been building Mac Service applications for over 10 years.

As far as I know the only major difference is that Console apps do not have the DontDaemonize event. I think it just ignores that event on the Mac.

Are you saying that if I build it as a Console app then the info.plist will be included?

Try it, but I believe the info.plist file is generated for macOS desktop applications alone, not Console or Web apps.

@James Meyer — Have you tried creating a bundle yourself and adding an Info.plist file?

I just tried it… ie built a Mac Console app that included an info.plist… The info.plist is not included in the built app.

Before you try with Xojo copy the plist file you made manually to where the plist file should be. Hmm… That would be the contents folder. Is there something like a contents folder for a console app? I don’t think so.

This question might be more for Stackoverflow or even a dedicated Mac development forum.

@James Meyer — What I was suggesting is to build a Console app, then create a bundle structure and copy the Console app into it. Something like:
• Create the folders hierarchy myApp.app/Contents/MacOS
• Copy your console app into the MacOS subfolder
• Create your own Info.plist file in the Contents subfolder (this file must of course contain the name of your executable)

[quote=421946:@StphaneMons]@JamesMeyer What I was suggesting is to build a Console app, then create a bundle structure and copy the Console app into it. Something like:
Create the folders hierarchy myApp.app/Contents/MacOS
Copy your console app into the MacOS subfolder
Create your own Info.plist file in the Contents subfolder (this file must of course contain the name of your executable)[/quote]

I will try that… but even if it does work it presents me with a messy problem. I distribute the app for Windows, Linux and Mac… It is one project and App.Super is currently set to ServiceApplication. For Mac, I would seemingly need to copy the project, change the app’s super to ConsoleApplication then manually fix the app’s events so that it will compile. (You get an error if you try to compile a Mac console app that includes the service app dontdeamonize event.) That is certainly doable but a bit of a pain.

A console project that is a ServiceApplication still works on Mac OS. It’s just that the ServiceApplication events are only called when the app is installed as a service on Windows.

I came across a related issue. I had to include a plist file in the desktop version of my language interpreter (to allow HTTP calls) but the console app version of the interpreter works as expected. So in summary, you don’t seem to need a plist for console apps on macOS if you’re using NSAppTransportSecurity. Tested on Mojave.

Not sure if this is helpful, but you may try packaging the service application with Platypus. This could be called from a build step using their command line version. The result would be a packaged application bundle complete with an info.plist according to the profile used.

I believe you can invoke the linker tool ("/usr/bin/ld") and pass it the “-sectcreate __TEXT __info_plist path/to/file” option in order to embed the Info.plist into your executable.