Post

Replies

Boosts

Views

Activity

LaunchAgent in Objective C, Sandboxed App in Swift, how to connect
Hi,the LaunchAgent is implemented with this (cutout):@interface ServiceDelegate : NSObject @end @implementation ServiceDelegate - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(pEpMacOSAdapterProtocol)]; pEpMacOSAdapter *exportedObject = [pEpMacOSAdapter new]; newConnection.exportedObject = exportedObject; [newConnection resume]; return YES; } @end int main(int argc, const char *argv[]) { ServiceDelegate *delegate = [ServiceDelegate new]; NSXPCListener *listener = [[NSXPCListener alloc] initWithMachServiceName:@"foundation.pEp.adapter.macOS"]; [listener resume]; [[NSRunLoop currentRunLoop] run]; return 0; }<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>foundation.pEp.adapter.macOS</string> <key>ProgramArguments</key> <array> <string>/Library/Application Support/pEp/foundation.pEp.adapter.macOS</string> </array> <key>MachServices</key> <dict> <key>foundation.pEp.adapter.macOS</key> <true/> </dict> </dict> </plist>The App is implemented with this (cutout):func proxyErrorHandler(err: Error) -> Void { NSLog("%@", err.localizedDescription) statusText.title = NSLocalizedString("Connection failed", comment: "") } internal func applicationDidFinishLaunching(_ aNotification: Notification) { connection = NSXPCConnection.init(machServiceName: "foundation.pEp.adapter.macOS") if connection != nil { connection.remoteObjectInterface = NSXPCInterface.init(with: pEpMacOSAdapterProtocol.self) connection.resume() statusText.title = NSLocalizedString("Connecting…", comment: "") proxy = connection.remoteObjectProxyWithErrorHandler(proxyErrorHandler) as? pEpMacOSAdapterProtocol proxy?.subscribeForUpdate(downloadNotification: notifyDownload) } else { NSLog("pEpNotifications: %@", "cannot connect to pEp.foundation.adapter.macOS") } }I'm always getting proxyErrorHandler() called with "Couldn’t communicate with a helper application."Any ideas?
5
0
1.6k
Jun ’20
Xcode produces XPC service which crashes on startup
When using the Xcode template for XPC service and compiling, the generated binary crashes.To reproduce select File, New, Project, XPC Service, give the name “Sample” and store with defaults. Compile. Try to run the generated binary.$ Debug/Sample.xpc/Contents/MacOS % ./Sample [1] 44094 illegal hardware instruction ./SampleFiled it with feedback assistant https://feedbackassistant.apple.com/feedback/7723709Can anyone confirm? Ideas how to get it to work? Using Xcode Version 11.5 (11E608c) on macOS Catalina 10.15.5 (19F101)
2
0
729
Jun ’20