nsxpcconnection

How do you make a Swift class available in an XPC service?

烈酒焚心 提交于 2021-02-11 04:32:00
问题 I'm attempting to rebuild Apple's XPC "lowerCase" sample code from Objective-C to Swift. I understand XPC will, but I'm relatively new to Swift and Objective-C interoperability. When I use their exact sample code, which passes a String from the app to the target and back, it works. But when I try and replace that with my own custom class, Person , I get the error: NSXPCConnection: ... connection on anonymousListener or serviceListener from pid 4133: Exception caught during decoding of

How do you make a Swift class available in an XPC service?

半腔热情 提交于 2021-02-11 04:27:22
问题 I'm attempting to rebuild Apple's XPC "lowerCase" sample code from Objective-C to Swift. I understand XPC will, but I'm relatively new to Swift and Objective-C interoperability. When I use their exact sample code, which passes a String from the app to the target and back, it works. But when I try and replace that with my own custom class, Person , I get the error: NSXPCConnection: ... connection on anonymousListener or serviceListener from pid 4133: Exception caught during decoding of

How do you make a Swift class available in an XPC service?

孤街醉人 提交于 2021-02-11 04:25:41
问题 I'm attempting to rebuild Apple's XPC "lowerCase" sample code from Objective-C to Swift. I understand XPC will, but I'm relatively new to Swift and Objective-C interoperability. When I use their exact sample code, which passes a String from the app to the target and back, it works. But when I try and replace that with my own custom class, Person , I get the error: NSXPCConnection: ... connection on anonymousListener or serviceListener from pid 4133: Exception caught during decoding of

helper app sandboxing and security scoped bookmarks

天涯浪子 提交于 2021-01-28 03:23:01
问题 so Ive been tearing my hair out with this... I have a main app, and a helper app. both are sandboxed and are sharing data using App Groups. I talk to the helper app by way of NSXPCConnection. I have the helper app set up as a login item using SMLoginItemSetEnabled . the helper app runs as a daemon when the user has it activated. this all works well. the problem is with the security scoped bookmarks. The helper app needs to access system files. when i need to grant access to new locations,

Using custom class in XPC protocol

冷暖自知 提交于 2020-06-27 16:59:06
问题 I’m attempting to write an XPC service using my own type on the withReply signature. The type/class has Xcode’s “target membership” of both the main app and the XPC service. However I am getting incompatible reply block signature in the debug output even though the same class is being used in the withReply signature however the Xcode target differs as I will explain below. Note: This is being done in Swift using this project to get me started. Except there they use NSData instead of a custom

Using Sockets with NSXPCConnection

99封情书 提交于 2019-12-13 04:46:43
问题 Running into an issue when using sockets with an NSXPCConnection. Basically, there is a main process and a helper process running, established via NSXPCConnection. That helper process needs to act as a server and listen to a particular port (say 111), which receives outside connections. The helper process opens a listening socket using the TCPServer helper class (wrapper around CFSocket ) which is provided by Apple. Code found here: https://code.google.com/p/iphone-remotepad/source/browse

NSWorkspace runningApplications doesn't return my XPC mach service

我只是一个虾纸丫 提交于 2019-12-11 01:36:50
问题 NSArray *activeApps = [[NSWorkspace sharedWorkspace] runningApplications]; Returns running applications and agents, but i cannot see my running XPC mach service (although it is running and visible in activity monitor processes) even when i look up the PID in activity monitor id res = [NSRunningApplication runningApplicationWithProcessIdentifier:223]; i get res nil, although with other processes this works well 回答1: The NSRunningApplication documentation states: Only user applications are

XPC Between two cocoa applications in workspace, the NSXPCConnection is immediately being invalidated

牧云@^-^@ 提交于 2019-12-05 02:07:42
问题 I have two Cocoa Applications, one is going to be the sender and another the receiver in this XPC relationship. In the applicationDidFinishLaunching in the sender, I first open the second receiver application NSError* error = nil; NSURL* url = [[NSBundle mainBundle] bundleURL]; url = [url URLByAppendingPathComponent:@"Contents" isDirectory:YES]; url = [url URLByAppendingPathComponent:@"MacOS" isDirectory:YES]; url = [url URLByAppendingPathComponent:@"TestXPCHelper.app" isDirectory:YES]; [

Running multiple instances of the same XPC service (NSXPCConnection)

一笑奈何 提交于 2019-11-30 06:49:35
Is it possible to run multiple instances of the same XPC service using the XPC APIs found in Foundation.framework ( NSXPCConnection , etc.)? The docs don't provide much insight on this matter. EDIT : Did a quick test, and it seems like only one instance of the service is running even though I created two XPC connections. Is there any way to have it run another instance? I believe XPC services designed for one instance per multiple connections. Probably, it is more convenient to manage named pipes with one running executable. So, the most likely it is impossible to create multiple instances

Running multiple instances of the same XPC service (NSXPCConnection)

…衆ロ難τιáo~ 提交于 2019-11-29 08:38:30
问题 Is it possible to run multiple instances of the same XPC service using the XPC APIs found in Foundation.framework ( NSXPCConnection , etc.)? The docs don't provide much insight on this matter. EDIT : Did a quick test, and it seems like only one instance of the service is running even though I created two XPC connections. Is there any way to have it run another instance? 回答1: I believe XPC services designed for one instance per multiple connections. Probably, it is more convenient to manage