Privacy Manifest Script (for Release builds)
Privacy Manifest Script (for Release builds)
To comply with Apple's privacy requirements, each embedded framework in the app must include a PrivacyInfo.xcprivacy
file.
This can be automated by adding a Run Script in your app target’s Build Phases.
Note: This Run Script must run after “Embed Frameworks” and before code signing.
Steps
- Obtain the
PrivacyInfo.xcprivacy
manifest file from the Nuclei team and place it in your project folder. - Open your App Target → Build Phases.
- Locate "Embed Pods Frameworks" (added automatically by CocoaPods).
- Add a New Run Script Phase and drag it below "Embed Pods Frameworks".
This ensures that all frameworks are already copied into the app bundle before the script runs.
Any modification (adding PrivacyInfo.xcprivacy
) happens after Xcode’s Copy Files phase, so Release builds won’t overwrite it.
Script
#!/bin/bash
# Only run in Release builds
if [ "${CONFIGURATION}" != "Release" ]; then
echo "Skipping PrivacyInfo injection for non-Release build (${CONFIGURATION})"
exit 0
fi
# Path to your privacy manifest in the project
PRIVACY_MANIFEST="${SRCROOT}/PrivacyInfo.xcprivacy"
if [ ! -f "$PRIVACY_MANIFEST" ]; then
echo ":warning: Privacy manifest not found at $PRIVACY_MANIFEST"
exit 1
fi
# Path to the embedded frameworks in the app bundle
FRAMEWORKS_DIR="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "Injecting PrivacyInfo.xcprivacy into all frameworks in $FRAMEWORKS_DIR..."
# Recursively find all frameworks
find "$FRAMEWORKS_DIR" -type d -name "*.framework" | while read -r FRAMEWORK; do
PRIVACY_FILE="$FRAMEWORK/PrivacyInfo.xcprivacy"
if [ ! -f "$PRIVACY_FILE" ]; then
cp "$PRIVACY_MANIFEST" "$PRIVACY_FILE"
echo ":white_check_mark: Injected into $FRAMEWORK"
else
echo ":fast_forward: Already exists in $FRAMEWORK, skipping"
fi
done
echo ":white_check_mark: PrivacyInfo.xcprivacy injection completed for Release build!"