Forum Xamarin.iOS

MacOS X "Service" - How to?

Hi folks,

I've got a Self-hosted WebAPI service and wanted to get this running on a MacOS X (Server). Is there a best practice guide for this purpose?

Answers

  • I looked into this recently for a background process I wanted to run on a Mac. If you plan on keeping a particular user logged in, I found two easy ways to do this.

    Option 1: (I like this option because it bundles the runner and the self hosted web service like a true app)

    • Create a XamMac/MonoMac application
    • Delete the MainWindow and MainViewController
    • Remove usage of MainViewController in the AppDelegate
    • Add your startup code to the FinishedLaunching
    • Add "Application is background only" = true to Info.plist Source
    • Build
    • Move app to desired location
    • Add to launch items using System Prefs

    Option 2:

    • Use automator to create an application
    • Have the application run the appropriate command line to start your service
    • Build
    • Move app to desired location
    • Add to launch items using System Prefs
  • That looks good. Let's see if it fits into my solution.

    What about if I don't want a user logged in?

Sign In or Register to comment.