Provisioning profile contains attribute that triggers error

I recently renewed a provisioning profile and now i'm getting the following warning (and failure when building during code signing):

warning: Provisioning profile "[redacted]" for "OneMedly" contains entitlements that aren't in the entitlements file: com.apple.developer.healthkit.background-delivery. To use these entitlements, add them to your entitlements file. Otherwise, remove unused entitlements from your provisioning profile. (in target 'OneMedly' from project 'OneMedly')

The app does use HealthKit and the provisioning profile (which apple generates) has HealthKit and if I inspect the provisioning profile, it does indeed contain this healthkit.background-delivery attribute.

This doesn't seem to be problem for debug builds, only for release builds.

Does anyone know what is causing this warning/error? Is there a workaround?

What version of Xcode are you using?

What platform are you targeting?

And, if it’s the Mac, is this the Mac App Store? Or independent distribution using Developer ID.

Is this failing during the build (Product > Archive)? Or when you export from the Xcode organizer?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It doesn't stop Xcode from creating the archive, but it does throw a warning.

I’m gonna call this a bug )-:

Just adding the capability to my entitlements file feels like a bad idea since I don't need this capability

Agreed.

What’s happening here is that adding the HealthKit capability to your project causes Xcode to add the following entitlements to the allowlist in your provisioning profile:

<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array>
    <string>health-records</string>
</array>
<key>com.apple.developer.healthkit.background-delivery</key>
<true/>

And, of course, you only need the first two.

Note For general info on how provisioning profiles work, see my What exactly is a provisioning profile? post.

Xcode should ignore entitlements in the allowlist that you don’t then claim, but that’s not happening here.

Under normal circumstances I’d recommend that you file a bug against Xcode but in this case that’s not necessary. While looking into this I reproduced the problem with Xcode 12.5. I then tried the same project on Xcode 13.0b5, and it went away. Notably, Xcode 13 beta has a new Background Delivery checkbox in Signing & Capabilities > HealthKit, so this is clearly a deliberate fix.

My advice:

  • Ignore this warning for the moment.

  • Upgrade to Xcode 13 as soon as we release a version that’s approved for building App Store apps.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Provisioning profile contains attribute that triggers error
 
 
Q