Privacy Manifests

rshankras/claude-code-apple-skills/skills/security/privacy-manifests

作者 rshankras9ffb83138209無授權條款784 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫2 個月前更新

Privacy manifest (PrivacyInfo.xcprivacy) implementation including required reason APIs, tracking domains, third-party SDK declarations, and App Tracking Transparency. Use when preparing apps for App Store privacy requirements.

AI 產生的概覽

指導實作 Apple 隱私清單(PrivacyInfo.xcprivacy)、必要理由 API、追蹤宣告與 ATT,以符合 App Store 送審要求。

功能
這個顧問型技能說明 Apple 隱私清單要求:PrivacyInfo.xcprivacy 檔案格式、必要理由 API 類別與理由代碼、追蹤網域與 NSPrivacyTracking、第三方 SDK 宣告、App Tracking Transparency、隱私營養標籤,以及 Xcode 隱私報告。它提供掃描指令、XML 範本、決策表、常見錯誤與審查清單,用來產生或稽核清單項目。它僅為說明內容,不附帶指令碼。
適用情境
在為 App Store 隱私要求做準備、建立或稽核 PrivacyInfo.xcprivacy 檔案、處理關於必要理由 API 的 App Store 退件、宣告追蹤網域,或實作 App Tracking Transparency 時使用。
執行需求
不需要指令碼或特殊工具;代理只需檔案讀取與搜尋工具(Read、Glob、Grep)來檢查專案。不需要網路存取,儘管文件中包含指向 Apple 文件的連結。

Privacy Manifests

Advisory skill for implementing Apple's privacy manifest (PrivacyInfo.xcprivacy) requirements: manifest file format, required reason APIs, tracking declarations, third-party SDK privacy, and App Tracking Transparency.

When This Skill Activates

Use this skill when the user:

  • Asks about "privacy manifest" or "PrivacyInfo.xcprivacy"
  • Mentions "required reason API" or App Store privacy rejection
  • Needs to declare "tracking domains" or "NSPrivacyTracking"
  • Asks about "App Tracking Transparency" or ATT
  • Wants to audit third-party SDK privacy declarations
  • Is preparing an app for App Store submission and mentions privacy
  • Gets an App Store Connect warning about missing privacy manifests
  • Asks about "privacy nutrition labels" or App Store privacy details

Decision Tree

ProblemSection
Creating PrivacyInfo.xcprivacy from scratchPrivacy Manifest File Format + Required Reason APIs
App Store rejection about required reason APIsRequired Reason APIs (match APIs in your code)
Declaring tracking domainsTracking Domains and NSPrivacyTracking
Third-party SDK privacyThird-Party SDK Declarations
Implementing ATTApp Tracking Transparency
Filling out App Store privacy labelsPrivacy Nutrition Labels
Generating Xcode reportXcode Privacy Report

Review Process

1. Scan the Project

bash
Glob: **/PrivacyInfo.xcprivacyGrep: "NSPrivacyAccessedAPITypes|NSPrivacyTracking|NSPrivacyTrackingDomains"Grep: "NSFileCreationDate|NSFileModificationDate|NSURLCreationDateKey"Grep: "systemUptime|ProcessInfo.*processInfo"Grep: "volumeAvailableCapacity|URLResourceKey.*volume"Grep: "UserDefaults"Grep: "activeInputModes|UITextInputMode"Grep: "ATTrackingManager|requestTrackingAuthorization"

2. Determine What Is Missing and Apply Fixes

Check: Does PrivacyInfo.xcprivacy exist? Are all required reason APIs declared? Is NSPrivacyTracking correct? Are tracking domains listed? Do third-party SDKs have their own manifests? Use the sections below to generate correct entries.


Privacy Manifest File Format

The privacy manifest is a property list named PrivacyInfo.xcprivacy. Add it via File > New > File > App Privacy in Xcode. Four required top-level keys:

xml
<?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>NSPrivacyTracking</key>    <false/>    <key>NSPrivacyTrackingDomains</key>    <array/>    <key>NSPrivacyCollectedDataTypes</key>    <array/>    <key>NSPrivacyAccessedAPITypes</key>    <array/></dict></plist>

Where to Place the File

  • App targets: Add PrivacyInfo.xcprivacy to the root of the app bundle. In Xcode, ensure it is included in the target's "Copy Bundle Resources" build phase.
  • Frameworks/SDKs: Place PrivacyInfo.xcprivacy in the root of the framework bundle.
  • Swift packages: Place PrivacyInfo.xcprivacy in the package's resource bundle and declare it in Package.swift:
swift
// Package.swift.target(    name: "MyLibrary",    resources: [        .copy("PrivacyInfo.xcprivacy")    ])

Required Reason APIs

Apple requires you to declare why your app uses certain system APIs. You must include at least one valid reason code for each API category your app uses.

File Timestamp APIs (NSPrivacyAccessedAPICategoryFileTimestamp)

APIs that access file creation or modification dates.

Reason CodeDescription
DDA9.1Display file timestamps to the user
C617.1Access timestamps inside the app container, app group container, or CloudKit container
3B52.1Access timestamps of files or directories the user specifically granted access to (document picker, drag and drop)
0A2A.1Access timestamps for files managed by the app itself (third-party SDK only)

Common triggers: NSFileCreationDate, NSFileModificationDate, NSURLContentModificationDateKey, NSURLCreationDateKey, getattrlist, stat, fstat.

System Boot Time APIs (NSPrivacyAccessedAPICategorySystemBootTime)

APIs that read how long the system has been running.

Reason CodeDescription
35F9.1Measure elapsed time between events within the app
8FFB.1Calculate absolute timestamps for events (e.g., events that occurred before app launch)
3D61.1Access system boot time for the purposes of user-facing functionality

Common triggers: systemUptime, ProcessInfo.processInfo.systemUptime, mach_absolute_time, clock_gettime(CLOCK_MONOTONIC).

Disk Space APIs (NSPrivacyAccessedAPICategoryDiskSpace)

APIs that query available or total disk space.

Reason CodeDescription
E174.1Display disk space to the user
85F4.1Check whether there is sufficient disk space to write files
AB6B.1Query disk space for the app's own functionality, do not send off device
7D9E.1Query disk space for the app's own functionality, results sent off device (e.g., analytics)

Common triggers: volumeAvailableCapacityKey, volumeAvailableCapacityForImportantUsageKey, volumeAvailableCapacityForOpportunisticUsageKey, volumeTotalCapacityKey, statfs, statvfs.

User Defaults APIs (NSPrivacyAccessedAPICategoryUserDefaults)

APIs that read or write to UserDefaults.

Reason CodeDescription
CA92.1Read/write data accessible only to the app itself
1C8F.1Read/write data accessible to app groups (shared UserDefaults)
C56D.1Read/write data from a third-party SDK for the SDK's own functionality
AC6B.1Read data from UserDefaults to retrieve a configuration set by an MDM (managed device)

Common triggers: UserDefaults, NSUserDefaults, standardUserDefaults.

Active Keyboards API (NSPrivacyAccessedAPICategoryActiveKeyboards)

APIs that enumerate installed keyboards.

Reason CodeDescription
3EC4.1Customize the app's UI based on active keyboards (e.g., supporting specific languages)
54BD.1A custom keyboard app accessing active keyboards to implement its functionality

Common triggers: UITextInputMode.activeInputModes, activeInputModes.

Declaring Required Reason APIs in the Manifest

Each entry has the category identifier and an array of reason codes. See "Common Patterns" below for a full XML example.


Tracking Domains and NSPrivacyTracking

NSPrivacyTracking declares whether your app tracks users. Apple defines tracking as: linking user/device data from your app with data from other companies' apps, websites, or offline properties for advertising, or sharing data with data brokers.

Apple does not consider these to be tracking: on-device-only data linking, fraud detection, security, or compliance.

If NSPrivacyTracking is true:

  • You must implement App Tracking Transparency (ATT) before any tracking occurs
  • List all tracking domains in NSPrivacyTrackingDomains (the system blocks them until ATT is granted)
xml
<key>NSPrivacyTracking</key><true/><key>NSPrivacyTrackingDomains</key><array>    <string>analytics.example.com</string>    <string>tracker.adnetwork.com</string></array>

If your app does not track users, set NSPrivacyTracking to false and leave the domains array empty.


Third-Party SDK Declarations

SDK Privacy Manifests

Starting Spring 2024, apps that include commonly used third-party SDKs must ensure those SDKs provide their own PrivacyInfo.xcprivacy files. Apple publishes a list of SDKs that require privacy manifests and signatures, including Alamofire, FBSDKCoreKit, Firebase, Google Analytics, Kingfisher, Lottie, Realm, SDWebImage, and many others. See Apple's full list.

SDK Signatures

Third-party XCFrameworks should be signed by their developer. Prefer SDKs distributed through Swift Package Manager (signatures verified automatically). For XCFrameworks, verify the signature matches the expected developer.

Auditing Third-Party SDKs

bash
Glob: **/Pods/**/PrivacyInfo.xcprivacyGlob: **/.build/**/PrivacyInfo.xcprivacyGlob: **/Carthage/**/PrivacyInfo.xcprivacyGrep: "pod '|.package(url:"

If a third-party SDK lacks a privacy manifest and uses required reason APIs, contact the maintainer -- declaring its API usage in your own manifest is a stopgap, not a fix.


App Tracking Transparency

When ATT Is Required

You must present the ATT prompt if:

  • NSPrivacyTracking is true in your privacy manifest
  • Your app links user data with third-party data for advertising
  • You use advertising identifiers (IDFA) for tracking purposes

You do not need ATT for:

  • First-party analytics that stay on-device or on your own servers without linking to third-party data
  • SKAdNetwork attribution (privacy-preserving, no user-level data)
  • Fraud detection or security purposes

Implementation

swift
import AppTrackingTransparency
func requestTrackingPermission() {    ATTrackingManager.requestTrackingAuthorization { status in        switch status {        case .authorized:            // IDFA available via ASIdentifierManager.shared().advertisingIdentifier            break        case .denied, .restricted:            // Do not track            break        case .notDetermined:            break        @unknown default:            break        }    }}

Info.plist Requirement

xml
<key>NSUserTrackingUsageDescription</key><string>We use this identifier to show you relevant ads and measure ad performance.</string>

SKAdNetwork for Attribution

Register ad network identifiers in Info.plist:

xml
<key>SKAdNetworkItems</key><array>    <dict>        <key>SKAdNetworkIdentifier</key>        <string>example123.skadnetwork</string>    </dict></array>

Privacy Nutrition Labels

The privacy manifest feeds into the App Store privacy labels ("nutrition labels") displayed on your app's product page. The connection works as follows:

Manifest KeyApp Store Privacy Label
NSPrivacyCollectedDataTypes"Data Used to Track You" and "Data Linked to You" sections
NSPrivacyTrackingDetermines if "Data Used to Track You" section appears
NSPrivacyAccessedAPITypesNot directly shown, but required for submission

NSPrivacyCollectedDataTypes Format

Each entry declares: data type, whether it is linked to user identity, whether it is used for tracking, and purposes.

xml
<key>NSPrivacyCollectedDataTypes</key><array>    <dict>        <key>NSPrivacyCollectedDataType</key>        <string>NSPrivacyCollectedDataTypeEmailAddress</string>        <key>NSPrivacyCollectedDataTypeLinked</key>  <!-- linked to user identity? -->        <true/>        <key>NSPrivacyCollectedDataTypeTracking</key>  <!-- used for tracking? -->        <false/>        <key>NSPrivacyCollectedDataTypePurposes</key>        <array>            <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>        </array>    </dict></array>

Common data types: EmailAddress, Name, PhoneNumber, Location, DeviceID, CrashData, PerformanceData, ProductInteraction, PurchaseHistory (prefix each with NSPrivacyCollectedDataType).

Common purposes: AppFunctionality, Analytics, ThirdPartyAdvertising, ProductPersonalization (prefix each with NSPrivacyCollectedDataTypePurpose).

The App Store privacy label must match your manifest declarations. Inconsistencies trigger review delays or rejections.


Xcode Privacy Report

Generate a consolidated report via Product > Generate Privacy Report (or from the Organizer after archiving). Xcode produces a PDF listing all privacy manifest entries from the app and every embedded framework/SDK. Use this to verify all required reason APIs are declared, confirm third-party SDKs include their own manifests, and cross-check collected data types before filling out App Store Connect privacy labels.


Top Mistakes

  1. Missing PrivacyInfo.xcprivacy entirely -- Every App Store submission requires a privacy manifest. Without one, expect a warning or rejection.

  2. Using UserDefaults without declaring it -- declare NSPrivacyAccessedAPICategoryUserDefaults with reason CA92.1.

    • ❌ UserDefaults.standard.set(true, forKey: "onboardingComplete") with no manifest entry
    • ✅ Add CA92.1 declaration for data accessible only to the app
  3. Wrong reason code -- using DDA9.1 (display to user) when you never show timestamps in the UI causes rejection; use C617.1 for app container access instead.

  4. Forgetting third-party SDK manifests -- Your app's manifest does not cover SDKs. Each must provide its own. SDKs on Apple's list without manifests will flag your submission.

  5. NSPrivacyTracking true without ATT -- If you declare tracking, you must implement the ATT prompt before any tracking occurs. Missing this causes rejection.

  6. Stale privacy nutrition labels -- After updating your manifest, also update the App Store Connect privacy labels. Inconsistencies trigger review issues.


Review Checklist

  • PrivacyInfo.xcprivacy exists in the app target's bundle resources
  • NSPrivacyTracking set correctly (true only if the app tracks users)
  • NSPrivacyTrackingDomains lists all tracking domains (if tracking is true)
  • All required reason APIs declared with valid reason codes (file timestamps, boot time, disk space, UserDefaults, active keyboards)
  • Reason codes match actual API usage (not just any valid code)
  • NSPrivacyCollectedDataTypes lists all collected data
  • Third-party SDKs include their own PrivacyInfo.xcprivacy and are signed
  • ATT prompt implemented if NSPrivacyTracking is true
  • NSUserTrackingUsageDescription in Info.plist if ATT is used
  • App Store Connect privacy labels match manifest declarations
  • Xcode privacy report generated and reviewed (Product > Generate Privacy Report)
  • Swift packages declare PrivacyInfo.xcprivacy in their resource bundle

Common Patterns

Typical App (No Tracking)

Most apps need at minimum UserDefaults declared. Start from the minimal manifest structure above and populate NSPrivacyAccessedAPITypes:

xml
<key>NSPrivacyAccessedAPITypes</key><array>    <dict>        <key>NSPrivacyAccessedAPIType</key>        <string>NSPrivacyAccessedAPICategoryUserDefaults</string>        <key>NSPrivacyAccessedAPITypeReasons</key>        <array>            <string>CA92.1</string>        </array>    </dict>    <dict>        <key>NSPrivacyAccessedAPIType</key>        <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>        <key>NSPrivacyAccessedAPITypeReasons</key>        <array>            <string>C617.1</string>        </array>    </dict></array>

App with Tracking and Ad Attribution

Add to the template above: set NSPrivacyTracking to true, list tracking domains, add NSPrivacyCollectedDataTypes entries (see "Privacy Nutrition Labels" for format), implement ATT, and add NSPrivacyAccessedAPICategoryDiskSpace with reason 7D9E.1 if sending disk metrics off-device.


References

來源與署名

來源:rshankras/claude-code-apple-skills位於skills/security/privacy-manifests提交9ffb831

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架