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