Questions tagged [nsxpcconnection]

The NSXPCConnection API provides an objective-c RPC mechanism built on top of xpc.

55 questions
2
votes
2 answers

helper app sandboxing and security scoped bookmarks

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…
gypsyDev
  • 1,232
  • 1
  • 14
  • 22
2
votes
1 answer

NSWorkspace runningApplications doesn't return my XPC mach service

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…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
2
votes
1 answer

How should one write an XPC service with state?

I've read the NSXPC* docs, which advise making the vended service as stateless as possible. It's a good idea, at least to the docs and examples I've read, since the service and the calling app see each other as singletons and only one instance of…
CTMacUser
  • 1,996
  • 1
  • 16
  • 27
2
votes
1 answer

Is there a way to pass arbitrary struct via XPC?

I would like my Cocoa app to communicate with a database server. Following the principle in the app sandbox design, it would make sense for the DB communications to be split out into an XPC service. Since an XPC service is supposed to be stateless,…
Ben
  • 542
  • 1
  • 5
  • 12
1
vote
1 answer

NSXPCInterface setClasses causes "Lazily named class 0x600000xxxxxx wasn’t named by lazy name handler" on Xcode 14+ Swift @objc enum

After updating to Xcode 14 I am getting the SIGABRT crash "Lazily named class 0x600000dc6520 wasn’t named by lazy name handler". In the latest version of Xcode 13 it compiles and runs without any flaw. The only thing different from the very basic is…
Lucas van Dongen
  • 9,328
  • 7
  • 39
  • 60
1
vote
1 answer

How do you use MTLSharedTextureHandle or MTLSharedEventHandle with the C XPC interface on macOS?

TL;DR: How do you encode and decode an MTLSharedTextureHandle and MTLSharedEventHandler such that it can be transported across an XPC connection inside an xpc_dictionary? A macOS application I'm working on makes extensive use of XPC services and…
kennyc
  • 5,490
  • 5
  • 34
  • 57
1
vote
1 answer

How to create a Hello World XPC program?

I'm new to Apple XPC tech(actually I'm also new to Objective-C), recently I want to learn something about XPC technology, which is used to communicate between processes. Does anybody know how to combine a command line hello world program with an…
Eric Wang
  • 21
  • 1
  • 2
1
vote
1 answer

SMJobBless and NSXPCConnection

There is an Apple SMJobBless example that show how to securely install a helper tool. SMJobBlessXPC is uses XPC (c API) over Mach ports for communication between the app and privileged helper tool. I need SMJobBlessXPC by using NSXPCConnection…
Ahmed Lotfy
  • 3,806
  • 26
  • 28
1
vote
2 answers

Kill XPC when parent app is still running

My parent application uses helper XPC to achieve some task T1. XPC service is implemented using NSXPCConnection. Once the task is complete I don’t need this XPC to be alive. Hence, the parent process calls invalidate on NSXPCConnection object. But,…
spd
  • 2,114
  • 1
  • 29
  • 54
1
vote
1 answer

Helper app performing regular task using NSXPCListener

My helper agent app needs to constantly perform one activity after its launch, but it also needs to communicate via XPC, to the main app However, the setup of the listener requires a specific main function, and that takes over the app (omitting the…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
1
vote
0 answers

XPC method not invoked with NSArray of NSValues as parameter

I have an XPC service compiled 32-bit for OS-X. One of it's methods takes a single argument as a parameter, and calls a given block back on the main process. This block takes 3 NSStrings and an NSArray that's supposed to contain NSValues solely.…
Niv
  • 2,294
  • 5
  • 29
  • 41
1
vote
1 answer

Passing data between 32 and 64bit cocoa applications

I have a 64 bit cocoa project that needs to use a 32-bit rendering library, which I cannot port to 64-bit. I decided to separate it to a rendering service, which will be compiled in 32-bit and will provide an interface for the library, and the main…
Niv
  • 2,294
  • 5
  • 29
  • 41
1
vote
1 answer

Using XPC to parallelize Cocoa WebView rendering

My Cocoa app needs to simultaneously render many batches of generated web pages. Since WebKit WebView rendering is restricted to the main thread, I can't use GCD to do this within the application's process, so I'm looking at using some sort of…
marcprux
  • 9,845
  • 3
  • 55
  • 72
1
vote
1 answer

Multi User Core Data w/ XPC

Howdie, This is my first post, so if this has been answered somewhere please forgive me (I did search). Problem: I have a Cocoa app that needs to share a single Core Data database among multiple user accounts on the system. Idea: I would create a…
user2420924
0
votes
1 answer

Fast shared memory on macOS using XPC

I have two GUI applications which use shared memory (8 memory instances, each ~100MB) with frequent read/write operations where one application ("server") writes to the memory, and the other reads from it. On Windows the "server" application creates…
Hyndrix
  • 4,282
  • 7
  • 41
  • 82