objc2_ad_support/generated/
ASIdentifierManager.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// The object that contains the advertising identifier.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/adsupport/asidentifiermanager?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct ASIdentifierManager;
16);
17
18unsafe impl NSObjectProtocol for ASIdentifierManager {}
19
20impl ASIdentifierManager {
21    extern_methods!(
22        /// The shared instance of the identifier manager class.
23        ///
24        /// - Returns: Returns the shared instance of the AdSupport identifier manager
25        /// class.
26        #[unsafe(method(sharedManager))]
27        #[unsafe(method_family = none)]
28        pub unsafe fn sharedManager() -> Retained<ASIdentifierManager>;
29
30        /// The UUID that is specific to a device.
31        ///
32        /// The ``ASIdentifierManager/advertisingIdentifier`` is an alphanumeric string
33        /// that’s unique to each device, and which you only use for advertising. Use
34        /// this string for frequency capping, attribution, conversion events,
35        /// estimating the number of unique users, advertising fraud detection, and
36        /// debugging. On devices running iOS 14.5 and later and iPadOS 14.5 and later,
37        /// your app must request tracking authorization before it can get the
38        /// advertising identifier. For more information on getting the advertising
39        /// identifier, see ``AdSupport``.
40        ///
41        /// The advertising identifier returns either a unique UUID, or all zeros. It
42        /// returns a unique UUID in the following cases:
43        ///
44        /// - If Settings
45        /// >
46        /// Privacy
47        /// >
48        /// Tracking
49        /// >
50        /// Allow Apps to Request to Track
51        /// is On, you’ve requested tracking authorization from the user by calling the
52        /// <doc
53        /// ://com.apple.documentation/documentation/apptrackingtransparency> APIs,
54        /// and received authorization, indicated by
55        /// <doc
56        /// ://com.apple.documentation/documentation/apptrackingtransparency/attrackingmanager/authorizationstatus/authorized>.
57        /// - If the user changes Settings
58        /// >
59        /// Privacy
60        /// >
61        /// Tracking
62        /// >
63        /// Allow Apps to
64        /// Request to Track to Off after authorizing your app, and leaves the
65        /// permissions On for your app.
66        ///
67        /// The advertising identifier returns all zeros
68        /// (`00000000-0000-0000-0000-000000000000`) in the following cases:
69        ///
70        /// - In Simulator, regardless of any settings.
71        /// - When you call this API on a device running macOS.
72        /// - When you call this API in a compatible iPad or iPhone app running in visionOS.
73        /// - On devices running iOS 14.5 and later and iPadOS 14.5 and later, if you haven’t requested authorization using the
74        /// <doc
75        /// ://com.apple.documentation/documentation/apptrackingtransparency> framework.
76        /// - If you’ve requested authorization using the
77        /// <doc
78        /// ://com.apple.documentation/documentation/apptrackingtransparency> framework and the user declines, which results in an authorization status of
79        /// <doc
80        /// ://com.apple.documentation/documentation/apptrackingtransparency/attrackingmanager/authorizationstatus/denied>.
81        /// - When a profile or configuration restricts access to the advertising identifier. For more information about restrictions, see
82        /// <doc
83        /// ://com.apple.documentation/documentation/apptrackingtransparency/attrackingmanager/authorizationstatus/restricted>.
84        ///
85        /// As a best practice, don’t store the advertising identifier value; access
86        /// ``ASIdentifierManager/advertisingIdentifier`` instead. Users can change
87        /// their authorization for tracking at any time in Settings
88        /// >
89        /// Privacy
90        /// >
91        /// Tracking. Check your app’s authorization using the App Tracking Transparency
92        /// API
93        /// <doc
94        /// ://com.apple.documentation/documentation/apptrackingtransparency/attrackingmanager/3547038-trackingauthorizationstatus>
95        /// to determine the user’s intent.
96        ///
97        /// For more information about asking users for permission to track, see [User
98        /// Privacy and Data
99        /// Use](https://developer.apple.com/app-store/user-privacy-and-data-use/).
100        #[unsafe(method(advertisingIdentifier))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn advertisingIdentifier(&self) -> Retained<NSUUID>;
103
104        /// A Boolean value that indicates whether the user has limited ad tracking
105        /// enabled.
106        ///
107        /// - Warning: This property is deprecated. Functionality has been replaced by
108        /// the
109        /// <doc
110        /// ://com.apple.documentation/documentation/apptrackingtransparency>
111        /// framework.
112        #[deprecated = "This has been replaced by functionality in AppTrackingTransparency's ATTrackingManager class."]
113        #[unsafe(method(isAdvertisingTrackingEnabled))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn isAdvertisingTrackingEnabled(&self) -> bool;
116    );
117}
118
119/// Methods declared on superclass `NSObject`.
120impl ASIdentifierManager {
121    extern_methods!(
122        #[unsafe(method(init))]
123        #[unsafe(method_family = init)]
124        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
125
126        #[unsafe(method(new))]
127        #[unsafe(method_family = new)]
128        pub unsafe fn new() -> Retained<Self>;
129    );
130}