SwiftyXPC icon indicating copy to clipboard operation
SwiftyXPC copied to clipboard

iOS compatibility (17.4+)

Open SystemKeeper opened this issue 1 year ago • 4 comments

It seems that XPC is available starting with iOS 17.4, according to https://developer.apple.com/documentation/xpc. Would be nice if the library could be used with iOS as well.

SystemKeeper avatar May 25 '24 14:05 SystemKeeper

While the XPC framework itself is available to iOS in some capacity, large swaths of it are marked unavailable.

Can you give an example of a use case on iOS where you'd want to use XPC? Most of the examples I can think of wouldn't be allowed on iOS.

CharlesJS avatar May 26 '24 06:05 CharlesJS

Can you give an example of a use case on iOS where you'd want to use XPC? Most of the examples I can think of wouldn't be allowed on iOS.

I was thinking of using it to communicate between the main app and a BroadcastUploadExtension (to send the captured frames to the main app). I haven’t looked into this in too much detail, but that was the first thing that came to my mind when I saw XPC support in 17.4.

SystemKeeper avatar May 26 '24 07:05 SystemKeeper

I just spent some time digging through the XPC headers to see if this had changed since the last time I looked at it, but it looks like of all the function and methods in service.h, connection.h, listener.h, and NSXPCConnection.h to actually create a listener connection, everything is still marked unavailable on iOS except for the APIs that create anonymous listeners. Anonymous listeners can be used to create an endpoint, and then a connection on the other side can be made from that endpoint, but since the only way I know of to send an endpoint is over an XPC connection, you have a chicken-and-egg problem. So unless Apple's extension API gives you some way to get at an XPC connection, I don't think there's actually a way to set it up (at least officially; I'm sure that all the mechanisms are still there, but being private API you probably wouldn't make it past App Store review if you used it).

If I'm missing something (and I'd love to be wrong on this), please let me know what you find and I'll take a look at it.

CharlesJS avatar May 26 '24 17:05 CharlesJS

Thank you for looking into this! I also played around with the APIs and it seems that you're right here :-(. Looks like I got a bit too excited when I saw that iOS 17.4 added compatibility, but this seems rather useless at the moment.

SystemKeeper avatar May 28 '24 19:05 SystemKeeper