I found a solution to this. The problem (at least, for me), is that the entitlements need be referenced by XCode’s CODE_SIGN_ENTITLEMENTS environment setting.
Background
If you generate an XCode project, go to the build settings and add a Capability, it generates a .entitlements file with the appropriate perms and adds the CODE_SIGN_ENTITLEMENTS setting to the xcconfig.
Of course, this isn’t really a practical workaround as it means every IOS build requires a manual step.
Solution
-
Create a .entitlements file in your project (I put it in /Source/[projectName]).
-
Open DefaultEngine.ini in a text editor.
-
Find the section [/Script/MacTargetPlatform.XcodeProjectSettings]
-
Add the setting, “PremadeIOSEntitlements=/Game/Path/To/File.entitlements”.
In my case, it looks like:
PremadeIOSEntitlements=/Game/Source/[projectName]/HealthKit.entitlement
NOTE: /Game/, in this case, is a macro for the project name. This might be a familiar convention to some but it threw for me a loop.
Further Thoughts
I’m not sure if this is the right solution. It’s what I came up with by discovering the CODE_SIGN_ENTITLEMENTS setting and then working backward through the UBT source to figure things out. Which feels “too hard” for what seems like it ought to be a common UE5-on-IOS feature.
Also, it might be that HealthKit is unique in that it requires this. Otherwise, I don’t see how the ini exposed Game Center support would ever work. Even if you check that box, it doesn’t add the CODE_SIGN_ENTITLEMENT reference.