30
30
static NSString *const LocaleLanguageCodeKey = @" localeLanguageCode" ;
31
31
static NSString *const UTCOffsetKey = @" UTCOffset" ;
32
32
static NSString *const IntegrationConfigurationKey = @" integrationConfiguration" ;
33
- static NSString *const AdvertisingIdentifierKey = @" advertisingIdentifier" ;
34
33
35
34
// Legacy keys
36
35
NSString *const ATDeviceLastUpdateValuePreferenceKey = @" ATDeviceLastUpdateValuePreferenceKey" ;
46
45
static NSDictionary *_currentIntegrationConfiguration;
47
46
static NSString *_currentCarrierName;
48
47
static UIContentSizeCategory _currentContentSizeCategory;
49
- static NSUUID * _Nullable _currentAdvertisingIdentifier;
50
48
51
49
52
50
@implementation ApptentiveDevice
@@ -79,50 +77,6 @@ + (UIContentSizeCategory)contentSizeCategory {
79
77
return _currentContentSizeCategory;
80
78
}
81
79
82
- + (void )getAdvertisingIdentifier {
83
- NSUUID *oldAdvertisingIdentifier = _currentAdvertisingIdentifier;
84
- _currentAdvertisingIdentifier = nil ;
85
- @try {
86
- Class IdentifierManager = NSClassFromString (@" ASIdentifierManager" );
87
- if (IdentifierManager) {
88
- #pragma clang diagnostic push
89
- #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
90
- id sharedManager = [IdentifierManager performSelector: NSSelectorFromString (@" sharedManager" )];
91
- SEL advertisingIdentifierSelector = NSSelectorFromString (@" advertisingIdentifier" );
92
- SEL advertisingTrackingEnabledSelector = NSSelectorFromString (@" isAdvertisingTrackingEnabled" );
93
-
94
- if (![sharedManager respondsToSelector: advertisingIdentifierSelector] ||
95
- ![sharedManager respondsToSelector: advertisingTrackingEnabledSelector]) {
96
- ApptentiveLogDebug (ApptentiveLogTagConversation, @" Unable to get advertising id: required method on ASIdentifierManager not found" );
97
- return ;
98
- }
99
-
100
- if (![sharedManager performSelector: advertisingTrackingEnabledSelector]) {
101
- ApptentiveLogDebug (ApptentiveLogTagConversation, @" Unable to get advertising id: advertising tracking disabled" );
102
- return ;
103
- }
104
-
105
- NSUUID *advertisingIdentifier = [sharedManager performSelector: advertisingIdentifierSelector];
106
- if ([advertisingIdentifier.UUIDString isEqualToString: @" 00000000-0000-0000-0000-000000000000" ]) {
107
- ApptentiveLogDebug (ApptentiveLogTagConversation, @" Unable to get advertising id: invalid value" );
108
- return ;
109
- }
110
-
111
- if (![advertisingIdentifier isEqual: oldAdvertisingIdentifier]) {
112
- ApptentiveLogVerbose (ApptentiveLogTagConversation, @" Updated advertising id: %@ " , advertisingIdentifier);
113
- }
114
- _currentAdvertisingIdentifier = advertisingIdentifier;
115
- #pragma clang diagnostic pop
116
- }
117
- } @catch (NSException *e) {
118
- ApptentiveLogError (ApptentiveLogTagConversation, @" Exception while trying to resolve advertising id.\n %@ " , e);
119
- }
120
- }
121
-
122
- + (NSUUID *)advertisingIdentifier {
123
- return _currentAdvertisingIdentifier;
124
- }
125
-
126
80
+ (void )getPermanentDeviceValues {
127
81
_currentUUID = [UIDevice currentDevice ].identifierForVendor ;
128
82
_currentOSName = [UIDevice currentDevice ].systemName ;
@@ -181,7 +135,6 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
181
135
182
136
NSSet *allowedClasses = [NSSet setWithArray: @[[NSDictionary class ], [NSString class ]]];
183
137
_integrationConfiguration = [aDecoder decodeObjectOfClasses: allowedClasses forKey: IntegrationConfigurationKey];
184
- _advertisingIdentifier = [aDecoder decodeObjectOfClass: [NSUUID class ] forKey: AdvertisingIdentifierKey];
185
138
}
186
139
187
140
return self;
@@ -202,7 +155,6 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {
202
155
[aCoder encodeObject: self .localeLanguageCode forKey: LocaleLanguageCodeKey];
203
156
[aCoder encodeInteger: self .UTCOffset forKey: UTCOffsetKey];
204
157
[aCoder encodeObject: self .integrationConfiguration forKey: IntegrationConfigurationKey];
205
- [aCoder encodeObject: self .advertisingIdentifier forKey: AdvertisingIdentifierKey];
206
158
}
207
159
208
160
- (instancetype )initAndMigrate {
@@ -252,8 +204,6 @@ - (void)updateWithCurrentDeviceValues {
252
204
_UTCOffset = [NSTimeZone systemTimeZone ].secondsFromGMT ;
253
205
254
206
_integrationConfiguration = ApptentiveDevice.integrationConfiguration ;
255
-
256
- _advertisingIdentifier = _currentAdvertisingIdentifier;
257
207
}
258
208
259
209
@end
@@ -273,10 +223,6 @@ - (NSString *)OSVersionString {
273
223
return self.OSVersion .versionString ;
274
224
}
275
225
276
- - (NSString *)advertisingIdentifierString {
277
- return self.advertisingIdentifier .UUIDString ;
278
- }
279
-
280
226
+ (NSDictionary *)JSONKeyPathMapping {
281
227
return @{
282
228
@" custom_data" : NSStringFromSelector (@selector (customData )),
@@ -292,7 +238,6 @@ + (NSDictionary *)JSONKeyPathMapping {
292
238
@" locale_language_code" : NSStringFromSelector (@selector (localeLanguageCode )),
293
239
@" utc_offset" : NSStringFromSelector (@selector (boxedUTCOffset )),
294
240
@" integration_config" : NSStringFromSelector (@selector (integrationConfiguration )),
295
- @" advertiser_id" : NSStringFromSelector (@selector (advertisingIdentifierString ))
296
241
};
297
242
}
298
243
0 commit comments