There is no need to rebuild the engine for this. An UPL script can be used to put the PrivacyInfo.xcprivacy
file where it is needed and make sure this is done during the Build / Stage / Archive steps.
Here are the steps to achieve it (assuming your project is named “MyProject”):
- Put your
PrivacyInfo.xcprivacy
file in theBuild/IOS/
folder. - Add the following UPL script in your
Source/MyProject
folder, name the fileAddPrivacyInfo_IOS_UPL.xml
. It must be next to yourMyProject.Build.cs
file. This script will make sure to copy thePrivacyInfo.xcprivacy
from theBuild/IOS
folder to the final folder used to generate the .ipa file that will be uploaded later to Apple servers:
<?xml version="1.0" encoding="utf-8"?>
<root>
<init>
<log text="In need of a PrivacyInfo.xcprivacy? No worries, I got you..."/>
<!-- PluginDir is the folder where this file is... weird name, but hey, I don't make the rules! -->
<copyFile src="$S(PluginDir)/../../Build/IOS/PrivacyInfo.xcprivacy" dst="$S(BuildDir)/PrivacyInfo.xcprivacy" />
</init>
</root>
- Edit your
Source/MyProject/MyProject.Build.cs
file and add the following lines. This will simply add the UPL script to the Build / Stage and Archive steps:
if (Target.Platform == UnrealTargetPlatform.IOS)
{
string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
AdditionalPropertiesForReceipt.Add("IOSPlugin", System.IO.Path.Combine(PluginPath, "AddPrivacyInfo_IOS_UPL.xml"));
}
- Package, check for the “In need of a PrivacyInfo.xcprivacy? No worries, I got you…” line in the logs and then enjoy seeing the
PrivacyInfo.xcprivacy
in the final .ipa file.
I am confident this can work for older version of UE, like UE4.27.