Health Records entitlement automatically being added.

We seem to be dealing with a weird issue where the clinical health records entitlement keeps on getting added into our final embedded.mobileprovision when we prepare a build for distribution.

We seem to get this in the final package.

Code Block
<key>com.apple.developer.healthkit.access</key>
<array>
<string>health-records</string>
</array>


But in our projects entitlement file there is no reference to health records. Below is the raw values inside of this file.

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.xxxxx</string>
</array>
</dict>
</plist>

And also in the project this isn't selected in the capabilities section either. Has anyone come across this issue before where Xcode automatically adds clinical records even though you haven't selected the checkbox.

Replies

Your provisioning profile acts as an allowlist for the entitlements in your code signature. Assuming a modern version of Xcode, the presence of an entitlement in the profile does not automatically add it to your app. Thus, it isn’t a problem having a redundant entitlement there.

What you should do is check the entitlements of your app. Don’t rely on the .entitlements file — that’s just one input to the code signing process — but instead use codesign to dump the entitlements that are actually baked into the code signature:

Code Block
% codesign -d --entitlements :- /path/to/your.app


Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
@eskimo I have tried this command and this is the output I am getting.

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "....">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>***.com.xxxx.app</string>
<key>aps-environment</key>
<string>production</string>
<key>beta-reports-active</key>
<true/>
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array/>
<key>com.apple.developer.team-identifier</key>
<string>xxxxx</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.xxxxxx</string>
</array>
<key>get-task-allow</key>
<false/>
</dict>
</plist>

Which is what I expect since there is no reference to the health records within the entitlement since I've not added it in the project, but when I go inside of the app's package contents and inspect the embedded.mobileprovision file the reference to health-records is still in there as you can see below.
Code Block
<key>com.apple.developer.healthkit</key>
<true/>
<key>get-task-allow</key>
<false/>
<key>com.apple.developer.healthkit.access</key>
<array>
<string>health-records</string>
</array>

The app keeps on getting rejected for the following reasons also.

Code Block
Guideline 2.5.1 - Performance - Software Requirements
Your app uses the Clinical Health Records API but your app does not appear to include any primary features that require the Clinical Health Records API.
Next Steps
To resolve this issue, please remove the Clinical Health Records API from your app, as well as any references to this app’s interactivity with Clinical Health Records from your app or its metadata.
To disable the functionality through App Store Connect, please uncheck the "Health Records" capability (leaving the HealthKit entitlement enabled), remove all the references to HKClinicalRecord class from your code, then resubmit.


But we can't remove something which is being added without our control. I've even tried other sample projects and it seems like this key is automatically being added in.

Hi, I am getting same issue. Did you manage to find a way around this? Thank you