xamarin-macios/docs/required-reasons-macios.md

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

Required Reasons API usage in .NET for iOS, tvOS, and Xamarin.iOS

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 for iOS, tvOS and Xamarin.iOS versions 8.0.4 and later.

File timestamp APIs

The following APIs either directly or indirectly access file timestamps and require reasons for use. Use the string NSPrivacyAccessedAPICategoryFileTimestamp as the value for the NSPrivacyAccessedAPIType key in your NSPrivacyAccessedAPITypes dictionary. Refer to File timestamp APIs for any additional relevent values to add to the NSPrivacyAccessedAPITypeReasons array.

Foundation APIs UIKit APIs AppKit APIs
NSFileManager.CreationDate UIDocument.FileModificationDate NSDocument.FileModificationDate
NSFileManager.ModificationDate
NSFileManager.SetAttributes(NSDictionary, string, NSError)
NSFileManager.SetAttributes(NSFileAttributes, string, NSError)
NSFileManager.SetAttributes(NSFileAttributes, string)
NSFileManager.CreateDirectory(string, bool, NSDictionary, NSError)
NSFileManager.CreateDirectory(string, bool, NSFileAttributes, NSError)
NSFileManager.CreateDirectory(string, bool, NSFileAttributes)
NSFileManager.CreateFile(string, NSData, NSDictionary)
NSFileManager.CreateFile(string, NSData, NSFileAttributes)
NSFileManager.GetAttributes(string, NSError)
NSFileManager.GetAttributes(string)
NSDictionary.ToFileAttributes()
NSUrl.ContentModificationDateKey
NSUrl.CreationDateKey

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>NSPrivacyAccessedAPICategoryFileTimestamp</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>...</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

Additional reason codes from File timestamp APIs can be provided in the array following the NSPrivacyAccessedAPITypeReasons key.

System boot time APIs

The following APIs either directly or indirectly access the system boot time and require reasons for use. Use the string NSPrivacyAccessedAPICategorySystemBootTime as the value for the NSPrivacyAccessedAPIType key in your NSPrivacyAccessedAPITypes dictionary. If you only access the system boot time from the list of APIs below, then use the 35F9.1 value in the NSPrivacyAccessedAPITypeReasons array.

Foundation APIs UIKit APIs AppKit APIs
NSProcessInfo.SystemUptime

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>NSPrivacyAccessedAPICategorySystemBootTime</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>35F9.1</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

Disk space APIs

The following APIs either directly or indirectly access the available disk space and require reasons for use. Use the string NSPrivacyAccessedAPICategoryDiskSpace as the value for the NSPrivacyAccessedAPIType key in your NSPrivacyAccessedAPITypes dictionary. If you access the available disk space from the list of APIs below, then use Disk space APIs to determine the correct values to place in the NSPrivacyAccessedAPITypeReasons array.

Foundation APIs UIKit APIs AppKit APIs
NSUrl.VolumeAvailableCapacityKey
NSUrl.VolumeAvailableCapacityForImportantUsageKey
NSUrl.VolumeAvailableCapacityForOpportunisticUsageKey
NSUrl.VolumeTotalCapacityKey
NSFileManager.SystemFreeSize
NSFileManager.SystemSize
NSFileManager.GetFileSystemAttributes(string, NSError)
NSFileManager.GetFileSystemAttributes(string)

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>NSPrivacyAccessedAPICategoryDiskSpace</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>...</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

Reason codes from Disk space APIs need to be provided in the array following the NSPrivacyAccessedAPITypeReasons key.

Active keyboard APIs

The following APIs either directly or indirectly access the list of available keyboards and require reasons for use. Use the string NSPrivacyAccessedAPICategoryActiveKeyboards as the value for the NSPrivacyAccessedAPIType key in your NSPrivacyAccessedAPITypes dictionary. If you access the list of available keyboards from the list of APIs below, then use Active keyboard APIs to determine the correct values to place in the NSPrivacyAccessedAPITypeReasons array.

Foundation APIs UIKit APIs AppKit APIs
UITextInputMode.ActiveInputModes

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>NSPrivacyAccessedAPICategoryActiveKeyboards</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>...</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

Reason codes from Active keyboard APIs need to be provided in the array following the NSPrivacyAccessedAPITypeReasons key.

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.

Foundation APIs UIKit APIs AppKit APIs
NSUserDefaults NSUserDefaultsController.NSUserDefaultsController(NSUserDefaults, NSDictionary)
NSUserDefaultsController.Defaults
NSUserDefaultsController.SharedUserDefaultsController

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.