App Startup in OSX with Xamarin.Mac

483 views Asked by At

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

0

There are 0 answers