FB11231018: Xcode 14 removes HomeKit entitlement from Mac Catalyst builds
- Date: 2022-08-12
- Resolution: Open
- Area: Xcode
- OS: macOS 12.5
- Type: Incorrect/Unexpected Behavior
- Keywords: Xcode, HomeKit, Catalyst
Details
What version of Xcode are you using?
Xcode 14 beta 5 (14A5294e)
Description
When building an app that supports Mac Catalyst and uses HomeKit, Xcode will remove the HomeKit entitlement from the app’s entitlements when building for Catalyst, rendering HomeKit unusable in Catalyst builds of the app.
I’m attaching a sample project that reproduces the issue.
Please list the steps you took to reproduce the issue:
- Create an iOS app in Xcode
- Add Mac Catalyst as one of the platforms for the app in the project’s General tab
- Add the HomeKit capability in the project’s Signing & Capabilities tab
- Build the app for Mac Catalyst
What did you expect to happen?
The app built for Mac Catalyst should include the com.apple.developer.homekit entitlement
What actually happened?
The app built for Mac Catalyst did not include the com.apple.developer.homekit entitlement
If you check the xcent file that’s generated by Xcode before signing the app, you’ll notice that it’s missing the “com.apple.developer.homekit” entitlement. Xcode is likely removing the entitlement at some point during the processing, only when building for Mac Catalyst.
If the built product is signed manually including the HomeKit entitlement, then it will work just fine. This can be done by adding the following script to run as one the target’s build phases: https://gist.github.com/insidegui/1275b0e81bb7b5a525368d55ecc96e2c