I am looking at example https://developer.xamarin.com/samples/mac/NSPortExample/
I am trying to recreate the Obj-C code into c# but I am not having any success.
Below is my simple version of the Obj-C , can anyone tell me what I am doing wrong, please.
static class MainClass
{
static void Main(string[] args)
{
NSApplication.Init();
var localPost = CFMessagePort.CreateLocalPort("com.example.app.port.server", HandleCFMessagePortCallBack, CFAllocator.Default);
CFRunLoopSource runSource = localPost.CreateRunLoopSource();
CFRunLoop.Current.AddSource(runSource, (NSString)string.Empty);
while(true){}
}
static NSData HandleCFMessagePortCallBack(int type, NSData data)
{
Console.WriteLine("Data:{0}",data);
return new NSData();
}
}