We maintain a device driver for macOS. This consists of a bunch of components including a Launch Agent, a (Cocoa/AppKit) status bar item app, and a "main" windowed UI app. These all communicate with each other via XPC using the "low level" XPC APIs (libxpc). The launch agent registers a named Mach XPC service, and the two apps connect to it when they launch.
Last year, we had an overhaul of the main UI app as we wanted to add a bunch of features. In the process we decided to switch it from Cocoa/AppKit to Mac Catalyst/UIKit as we were also contemplating porting the driver to iPadOS in future; plus, UIKit is a little simpler and I'm not a great UI programmer, so any simplification is welcome.
This has worked OK so far, but in our attempt to upgrade our build toolchain from Xcode 15.2 to Xcode 15.4 we found that the Catalyst app would no longer build. Apparently the xpc_connection_create_mach_service()
and xpc_connection_set_peer_code_signing_requirement()
functions are no longer available as of the Mac Catalyst SDK included with Xcode 15.3. This makes it impossible for the app to connect to the launch agent's XPC service.
A few things to note:
- These functions were never deprecated, so we did not have their impending removal on our radar.
- It seems they actually used to be available in the iOS SDK and were removed from that, so Mac Catalyst is effectively collateral damage. I don't think these would ever have been usable in apps on the iOS App Store, so perhaps they were removed from the iOS SDK ahead of support for notarised iOS app distribution.
- So it looks like they might have been removed from Mac Catalyst SDK by accident? I therefore filed a bug about this - FB13929309 - about 6 weeks ago. Reinstating the functions for Mac Catalyst would seem like a very straightforward fix, but I've not had a hint of feedback on the report.
I guess my forum question comes down to this: Is Mac Catalyst considered a platform for building macOS apps in its own right? Or are we "holding it wrong" and should we only treat it as a way of tweaking Mac ports of iOS/iPad-first apps? Should we expect APIs to disappear from the Mac Catalyst SDK with zero notice?
We can still build with Xcode 15.2 for the moment, and the app built this way runs fine up to and including the macOS 15 beta. But thanks to the limited forward and backward compatibility schedule for Xcode we can't stay on old Xcode for long We're also planning to make some feature changes to the app in the near future, and I don't want to be investing in an app built on a platform with no future. I'd rather port the app back to Cocoa/AppKit before adding features if that's the case.
There are two parts to this:
-
Why did these XPC APIs go away?
-
What’s the deal with Mac Catalyst overall?
I’ll tackle each in turn.
Regarding these XPC APIs, you are right that APIs shouldn’t just disappear without warning. If you see that, you should file a bug about it. And you’ve already done that (FB13929309
), so thanks!
I had a look at your bug and it’s clear that this was a mistake. I can’t offer definitive predictions about The Future™ but, as always, I recommend that you re-test with new betas of Xcode as we start seeding them.
Regarding Mac Catalyst as a whole, Apple rarely makes forward-looking statements about our platforms, but this is a rare exception to that rule. Watch WWDC 2022 Session 102 Platforms State of the Union, and specifically Josh’s section starting at 3:43.
Speaking for myself, I think I’m coming from the same place you are: I’m not a UI programmer at heart. That’s why I’m a big fan of SwiftUI. With SwiftUI I can cons up a basic interface and have it run natively on both iOS and macOS, without having to worry about the limitations of Mac Catalyst.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"