You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/NSXPC/Master
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
connection = new MyNSXPCConnectionMBS("com.mycompany.helper")
connection.resume
dim params() as Variant
params.Append 1
params.Append 2
connection.CallMethod("Test", nil, params)
End EventHandler
Property connection As NSXPCConnectionMBS
End Class
Class Window1 Inherits Window
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyNSXPCConnectionMBS Inherits NSXPCConnectionMBS
EventHandler Sub CallMethodReturned(name as string, tag as variant, Parameters() as variant, Results() as variant)
System.DebugLog CurrentMethodName
MsgBox "Got result: "+Results(0)
End EventHandler
EventHandler Sub ErrorHandler(error as NSErrorMBS)
System.DebugLog CurrentMethodName
MsgBox "Got error: "+error.LocalizedDescription
End EventHandler
EventHandler Sub InterruptionHandler()
System.DebugLog CurrentMethodName
MsgBox "Service app crashed."
End EventHandler
EventHandler Sub InvalidationHandler()
System.DebugLog CurrentMethodName
MsgBox "Service app invalidated connection."
End EventHandler
End Class