Search code examples
ioscordovaionic-frameworkcordova-iosprivacy-manifest

cordova-ios 7.1.0 privacy-manifest correct format?


I have an ionic cordova app. Apple is now requiring us to provide reasons for certain API access in our privacy-manifest. I need to add "CA92.1" as the reason for NSPrivacyAccessedAPICategoryUserDefaults.

I see cordova-ios 7.1.0 includes the ability to add a privacy-manifest to the config file.

I updated my cordova-ios to version 7.1.0 and updated my config.xml to look like this:

 <platform name="ios">
        <privacy-manifest>
            <key>NSPrivacyAccessedAPITypes</key>
            <array>
                <dict>
                    <key>NSPrivacyAccessedAPICategoryUserDefaults</key>
                    <string>CA92.1</string>
                </dict>
            </array>
        </privacy-manifest>
        .....

I also tried without the <dict/> tag

however I got an email from Apple:

ITMS-91056: Invalid privacy manifest - The PrivacyInfo.xcprivacy file from the following path is invalid: “PrivacyInfo.xcprivacy”. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, keys and values in your app’s privacy manifest must be in a valid format. For more details about privacy manifest files, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files.

Any ideas on how to adjust this to the correct format? Thanks :)

Added information: This is how cordova-ios describes it should be formatted: https://cordova.apache.org/announcements/2024/04/03/cordova-ios-7.1.0.html


Solution

  • I think I've figured it out. The correct format was:

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

    I also added all of the other properties. So for an example privacy-manifest.xml for others you can use mine as a template:

    <privacy-manifest>
        <key>NSPrivacyTracking</key>
        <false />
        <key>NSPrivacyTrackingDomains</key>
        <array />
        <key>NSPrivacyCollectedDataTypes</key>
        <array>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypeDeviceID</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                </array>
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypeEmailAddress</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypeName</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                    <string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypePaymentInfo</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypePhoneNumber</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypePhotosorVideos</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypeProductInteraction</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypePurchaseHistory</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                    <string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypeUserID</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                    <string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypeOtherDataTypes</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
            <dict>
                <key>NSPrivacyCollectedDataType</key>
                <string>NSPrivacyCollectedDataTypePhysicalAddress</string>
                <key>NSPrivacyCollectedDataTypeLinked</key>
                <true />
                <key>NSPrivacyCollectedDataTypePurposes</key>
                <array>
                    <string>NSPrivacyCollectedDataTypePurposeOther</string>
                </array>
                <key>NSPrivacyCollectedDataTypeTracking</key>
                <false />
            </dict>
        </array>
        <key>NSPrivacyAccessedAPITypes</key>
        <array>
            <dict>
                <key>NSPrivacyAccessedAPIType</key>
                <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
                <key>NSPrivacyAccessedAPITypeReasons</key>
                <array>
                    <string>CA92.1</string>
                </array>
            </dict>
        </array>
    </privacy-manifest>