diff --git a/docs/ios/privacy-manifest.md b/docs/ios/privacy-manifest.md index 2aea0028..be4775b8 100644 --- a/docs/ios/privacy-manifest.md +++ b/docs/ios/privacy-manifest.md @@ -2,6 +2,7 @@ title: "Apple privacy manifest" description: Learn how to include a privacy manifest in your .NET MAUI app on iOS. ms.date: 03/19/2024 +no-loc: [ "xcframework" ] --- # Apple privacy manifest @@ -27,20 +28,17 @@ For more information about creating a privacy manifest, see [Create a privacy ma > [!IMPORTANT] > The above guidelines are provided for your convenience. It’s important that you review Apple’s documentation on [privacy manifest files](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) before creating a privacy manifest for your project. -## Privacy manifest for Binding projects +## Privacy manifest for binding projects -If you are binding project owner, and you are binding a `xcframework`, then the `xcframework` provider will need to include the privacy manifest as part of the `xcframework`. Alternatively, you can provide documentation for package consumers to create the privacy manifest or change the bindings to bind an `xcframework` that has the privacy manifest included. It's not currently possible for binding project authors to include a privacy manifest outside an `xcframework` that will be recognized by Apple when submitting an app. +If you are binding project owner, and you are binding a xcframework, then the xcframework provider will need to include the privacy manifest as part of the xcframework. Alternatively, you can provide documentation for package consumers to create the privacy manifest or change the bindings to bind an xcframework that has the privacy manifest included. It's not currently possible for binding project authors to include a privacy manifest outside an xcframework that will be recognized by Apple when submitting an app. ## Create a privacy manifest -To add a privacy manifest to your .NET MAUI app project, add a new XML file named *PrivacyInfo.xcprivacy* to the *Platforms/iOS* or *Platforms/MacCatalyst* folder of your app project. Ensure that the *PrivacyInfo.xcprivacy* file doesn't have an *.xml* extension. Then, add the following XML to the file: +To add a privacy manifest to your .NET MAUI app project, add a new XML file named *PrivacyInfo.xcprivacy* to the *Platforms/iOS* folder of your app project. Ensure that the *PrivacyInfo.xcprivacy* file doesn't have an *.xml* extension. Then, add the following XML to the file: ```xml - @@ -71,9 +69,6 @@ To add these entries to your privacy manifest, open the *PrivacyInfo.xcprivacy* ```xml - NSPrivacyAccessedAPITypes @@ -88,9 +83,6 @@ Then, add the `NSPrivacyAccessedAPICategoryFileTimestamp` category with reason ` ```xml - NSPrivacyAccessedAPITypes @@ -124,407 +116,68 @@ Then, add the `NSPrivacyAccessedAPICategoryFileTimestamp` category with reason ` ``` -For the API, a reason code of `C617.1` is needed since modification dates are stored as a hash using , even though they aren't displayed to users. +These entries are the minimum you'll need for your app. If you use any of the required reasons APIs in a way that isn't covered by the reason codes provided, then you'll need to add additional reason codes to support your usage of the API. For more information about API use in the .NET runtime, .NET Base Class Library (BCL), .NET for iOS, and .NET MAUI that might cause you to need additional reason codes, see the links in the [See also](#see-also) section. -After adding these entries to your privacy manifest you need to determine if your app uses any .NET APIs that call into the required reason APIs. For more information, see [Required reasons API use in .NET MAUI](#required-reasons-api-use-in-net-maui), [Required reasons API use in .NET iOS](#required-reasons-api-use-in-net-ios), and [Required reasons API use in .NET](#required-reasons-api-use-in-net). +If your .NET MAUI app uses the [Preferences](~/platform-integration/storage/preferences.md) API or you use the API directly, you must include the reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryUserDefaults` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK directly or indirectly uses the API, via .NET MAUI's [Preferences](~/platform-integration/storage/preferences.md) API, your *PrivacyInfo.xcprivacy* file should contain an additional `dict` element in the `NSPrivacyAccessedAPITypes` key's array: + +```xml + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + + +``` + +You'll need to provide one or more reason codes from [User defaults APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401) on developer.apple.com. Add one or more of the reason codes below to indicate the correct usage: + +- `CA92.1` - to access user defaults in just your app. +- `1C8F.1` - to access user defaults from apps, app extensions, and App Clips that are members of the same App Group. +- `C56D.1` - to access user defaults from an SDK. +- `AC6B.1` - to access user defaults to read the com.apple.configuration.managed or com.apple.feedback.managed key. > [!IMPORTANT] > An app's *PrivacyInfo.xcprivacy* file may need to be updated if you modify the code in your app. This includes adding a NuGet package or binding project to your app that calls into any of Apple’s required reason APIs. -## Required reasons API use in .NET MAUI +## See also -The APIs in this section list .NET MAUI APIs that call the required reason APIs. If your app or SDK calls any of the APIs in this section, you must declare the reasons for their use in your privacy manifest. +Use the following links to learn more the required reasons API use in .NET MAUI, .NET iOS, and the .NET runtime and BCL: -> [!NOTE] -> The following APIs are verified for .NET MAUI versions 8.0.0 and later. - -### User defaults APIs - -.NET MAUI's preferences API uses the API to access user defaults. For more information about the preferences API, see [Preferences](~/platform-integration/storage/preferences.md). - -If your .NET MAUI app or SDK uses this API, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryUserDefaults` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK directly or indirectly uses the API, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryUserDefaults - NSPrivacyAccessedAPITypeReasons - - ... - - - - - -``` - -Reason codes from [User defaults APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401) need to be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -## Required reasons API use in .NET iOS - -The APIs in this section list .NET iOS APIs that call the required reason APIs. If your app or SDK calls any of the APIs in this section, you must declare the reasons for their use in your privacy manifest. - -> [!NOTE] -> The following APIs are verified for .NET iOS version 8.0.4 and later. - -### File timestamp APIs - -The following APIs directly or indirectly access file timestamps: - -| Foundation APIs | UIKit APIs | -| --------------- | ---------- | -| | | -| | | -| | | -| | | -| | | -| | | -| | | -| | | -| | | -| | | - -If your .NET MAUI app or SDK uses any of these APIs, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryFileTimestamp` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses any of the APIs listed above, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryFileTimestamp - NSPrivacyAccessedAPITypeReasons - - ... - - - - - -``` - -Reason codes from [File timestamp APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278393) can be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -### System boot time APIs - -The API directly or indirectly accesses the system boot time. - -If your .NET MAUI app or SDK uses this API, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategorySystemBootTime` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses the API, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategorySystemBootTime - NSPrivacyAccessedAPITypeReasons - - 35F9.1 - - - - - -``` - -Reason codes from [System boot time APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394) can be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -### Disk space APIs - -The following APIs directly or indirectly access the available disk space: - -- -- -- -- -- -- -- - -If your .NET MAUI app or SDK uses any of these APIs, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryDiskSpace` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses any of the APIs listed above, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryDiskSpace - NSPrivacyAccessedAPITypeReasons - - ... - - - - - -``` - -Reason codes from [Disk space APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278397) need to be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -### Active keyboard APIs - -The `AppKit.UITextInputMode.ActiveInputModes` API directly or indirectly accesses the list of available keyboards. - -If your .NET MAUI app or SDK uses this API, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryActiveKeyboards` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses the `AppKit.UITextInputMode.ActiveInputModes` API, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryActiveKeyboards - NSPrivacyAccessedAPITypeReasons - - ... - - - - - -``` - -Reason codes from [Active keyboard APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278400) need to be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -### User defaults APIs - -The API directly or indirectly accesses user defaults. - -If your .NET MAUI app or SDK uses this API, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryUserDefaults` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses the API, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryUserDefaults - NSPrivacyAccessedAPITypeReasons - - ... - - - - - -``` - -Reason codes from [User defaults APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401) need to be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -## Required reasons API use in .NET - -The APIs in this section list .NET APIs that call the required reason APIs. If your app or SDK calls any of the APIs in this section, you must declare the reasons for their use in your privacy manifest. - -> [!NOTE] -> The following APIs are verified for .NET versions 8.0.0 and later. - -### File timestamp APIs - -The following APIs directly or indirectly access file timestamps: - -- -- -- -- -- [`System.Runtime.Loader.AssemblyLoadContext.ResolveSatelliteAssembly`](https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs,763) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -If your .NET MAUI app or SDK uses any of these APIs, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryFileTimestamp` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses any of the APIs listed above, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryFileTimestamp - NSPrivacyAccessedAPITypeReasons - - C617.1,... - - - - - -``` - -Reason codes from [File timestamp APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278393) can be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. - -### System boot time APIs - -The following APIs directly or indirectly access the system boot time: - -- -- - -If your .NET MAUI app or SDK uses any of these APIs, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategorySystemBootTime` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses any of the APIs listed above, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategorySystemBootTime - NSPrivacyAccessedAPITypeReasons - - 35F9.1 - - - - - -``` - -Reason codes from [File timestamp APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394) can be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. If you only access the system boot time from the list of APIs, then use the `35F9.1` value in the `NSPrivacyAccessedAPITypeReasons` array. - -### Disk space APIs - -The following APIs directly or indirectly access the available disk space: - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -If your .NET MAUI app or SDK uses any of these APIs, you must include reasons for use in your privacy manifest. Use the string `NSPrivacyAccessedAPICategoryDiskSpace` as the value for the `NSPrivacyAccessedAPIType` key in your `NSPrivacyAccessedAPITypes` dictionary. For example, if your app or SDK uses any of the APIs listed above, your *PrivacyInfo.xcprivacy* file should contain the following `dict` element in the `NSPrivacyAccessedAPITypes` key's array: - -```xml - - - - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryDiskSpace - NSPrivacyAccessedAPITypeReasons - - E174.1,... - - - - - -``` - -Reason codes from [Disk space APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278397) can be provided in the array for the `NSPrivacyAccessedAPITypeReasons` key. +- [Required reasons API usage in .NET MAUI and Xamarin.Forms](https://github.com/xamarin/xamarin-macios/blob/main/docs/required-reasons-dotnet-maui.md) +- [Required reasons API usage in .NET for iOS, tvOS, and Xamarin.iOS](https://github.com/xamarin/xamarin-macios/blob/main/docs/required-reasons-macios.md) +- [Required reasons API usage in .NET, Mono and the BCL](https://github.com/xamarin/xamarin-macios/blob/main/docs/required-reasons-bcl.md)