[Mono-osx] How to Register Service in Mac OS?

Rolf-Helge Pfeiffer ropf at itu.dk
Sat Feb 23 13:22:05 UTC 2013

Dear all,

I am experimenting with Mono, MonoMac, and C#. I am writing a simple application based on a service for Mac OS. I followed Apple's developer documentation on implementation of service providers (http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/SysServices/Articles/providing.html).

My problem is how to register a service. In Objective-C I would call the setServicesProvider method of NSApplication. But it seems that there is no such a method in MonoMac. Is this right? At the following website (http://docs.go-mono.com/?link=P%3aMonoMac.AppKit.NSApplication.ServicesProvider) I found that NSApplication is supposed to have a services provider with a corresponding setter. But calling the SetServicesProvider in the following way:

	MyClass myClass = new MyClass();

results in the following error:

	Error CS0117: `MonoMac.AppKit.NSApplication' does not contain a definition for `SetServicesProvider' (CS0117)

What is the problem here? Is the ServicesProvider property part of the 10% of AppKit that is not implemented so far (http://www.mono-project.com/MonoMac says under Status section "AppKit (About 10% left to be done))?

Alternatively, I tried to find a class NSRegisterServicesProvider as suggested in the apple developer's example. But I cannot find such a class.

If anyone knows how to register a service using MonoMac could you please point me to an example?

Thank you very much,

PS: I am using MonoDevelop 3.1.1 and Xamarin.Mac development add-in (Version 3.1.1). The latter is at least what is stated in the add-in manager. The version information tab in the "About MonoDevelop" says "Xamarin.Mac: Not Installed". But I think the latter is not right since I get for example access to the NSApplication class using MonoMac.AppKit.

More information about the Mono-osx mailing list