xamarin-macios/docs/required-reasons-dotnet-mau...

3.0 KiB
Исходник Ответственный История

Required Reasons API usage in .NET MAUI and Xamarin.Forms

The tables provide lists of C# .NET APIs that call the Required Reasons APIs organized by category. If your application, SDK or package code calls any of the APIs from these lists, declare the reasons for their use in your privacy manifest file following the guidelines specified in Apples documentation on Required Reasons APIs.

Note: The following lists are verified only for .NET MAUI versions 8.0.0 and later.

User defaults APIs

The following APIs either directly or indirectly access user defaults and require reasons for use. Use the string NSPrivacyAccessedAPICategoryUserDefaults as the value for the NSPrivacyAccessedAPIType key in your NSPrivacyAccessedAPITypes dictionary. If you only access the user defaults from the list of APIs below, then use the value C56D.1 in the NSPrivacyAccessedAPITypeReasons array. Refer to User defaults APIs to determine the any additional relevant values to place in the NSPrivacyAccessedAPITypeReasons array.

API usage
NSUserDefaults

For example, if you use any of the APIs listed above, your PrivacyInfo.xcprivacy would contain the dict element in the NSPrivacyAccessedAPITypes key's array as shown below:

<?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>NSPrivacyAccessedAPITypes</key>
    <array>
        <dict>
            <key>NSPrivacyAccessedAPIType</key>
            <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>...</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

Reason codes from User defaults APIs need to be provided in the array following the NSPrivacyAccessedAPITypeReasons key.