3

How would one run an app at startup (user login) with Xamarin.Mac?

So far I have come across a few solutions, of which I have run in to some difficulties and want to gauge which is best before proceeding.

Service Management Framework

Using this example, I was able to create a small class wrapping the framework. See this snippet. I then embedded as a public read only singleton in the app delegate. However, when clicking the bound "Launch on Startup" button, the logs reveal the following message;

 19/10/2015 3:53:31.954 PM My Application[#####]: Could not enable login item: My.App: 3: No such process

Despite using the CFBundleIdentifier in the value, I can't seem to get it to function.

Launchd Property List

Another option I discovered was creating a .plist file in ~/Library/LaunchAgents with a structure not unlike this example for LastPass. However, this seems static, and would break if the .app was not stored in a common location.

As it stands, I would prefer using the Service Management Framework wrapper as it abstracts a little more, but I would like to see if any other community members have come across, and conquered the issue.

Cheers

Daniel Park
  • 3,903
  • 4
  • 23
  • 38
  • 1
    Did you manage to fix this one? – Artur Shamsutdinov Sep 12 '16 at 13:05
  • I did, however I no longer have immediate access to the source for this as I have since left the project I was working on. IIRC however, I ended up using the LaunchAgents method as it seemed to be the most commonly used. Hope this helps, and if you are going to use the same approach, [this](http://launchd.info/) is a stellar resource. – Daniel Park Sep 12 '16 at 23:52

0 Answers0