@@ -375,22 +375,22 @@ - (void)updateConsent {
375
375
NSNumber *adStorage = [self resolvedConsentForMappingKey: kMPFIRGAAdStorageKey
376
376
defaultKey: kMPFIRGA4DefaultAdStorageKey
377
377
gdprConsents: gdprConsents
378
- mappingsConfig : mappingsConfig];
378
+ mapping : mappingsConfig];
379
379
380
380
NSNumber *adUserData = [self resolvedConsentForMappingKey: kMPFIRGAAdUserDataKey
381
381
defaultKey: kMPFIRGA4DefaultAdUserDataKey
382
382
gdprConsents: gdprConsents
383
- mappingsConfig : mappingsConfig];
383
+ mapping : mappingsConfig];
384
384
385
385
NSNumber *analyticsStorage = [self resolvedConsentForMappingKey: kMPFIRGAAnalyticsStorageKey
386
386
defaultKey: kMPFIRGA4DefaultAnalyticsStorageKey
387
387
gdprConsents: gdprConsents
388
- mappingsConfig : mappingsConfig];
388
+ mapping : mappingsConfig];
389
389
390
390
NSNumber *adPersonalization = [self resolvedConsentForMappingKey: kMPFIRGAAdPersonalizationKey
391
391
defaultKey: kMPFIRGA4DefaultAdPersonalizationKey
392
392
gdprConsents: gdprConsents
393
- mappingsConfig : mappingsConfig];
393
+ mapping : mappingsConfig];
394
394
395
395
NSMutableDictionary *uploadDict = [NSMutableDictionary dictionary ];
396
396
@@ -637,7 +637,7 @@ - (void)updateInstanceIDIntegration {
637
637
- (NSNumber * _Nullable)resolvedConsentForMappingKey : (NSString *)mappingKey
638
638
defaultKey : (NSString *)defaultKey
639
639
gdprConsents : (NSDictionary <NSString *, MPGDPRConsent *> *)gdprConsents
640
- mappingsConfig : (NSDictionary <NSString *, NSString*> *) mapping {
640
+ mapping : (NSDictionary <NSString *, NSString*> *) mapping {
641
641
642
642
// Prefer mParticle Consent if available
643
643
NSString *purpose = mapping[mappingKey];
@@ -660,11 +660,20 @@ - (NSNumber * _Nullable)resolvedConsentForMappingKey:(NSString *)mappingKey
660
660
661
661
- (NSArray <NSDictionary *>*)mappingForKey : (NSString *)key {
662
662
NSString *mappingJson = _configuration[@" consentMappingSDK" ];
663
- if ([mappingJson isKindOfClass: [NSString class ]]) {
664
- NSData *jsonData = [mappingJson dataUsingEncoding: NSUTF8StringEncoding];
665
- return [NSJSONSerialization JSONObjectWithData: jsonData options: 0 error: nil ];
663
+ if (![mappingJson isKindOfClass: [NSString class ]]) {
664
+ return nil ;
666
665
}
667
- return nil ;
666
+
667
+ NSData *jsonData = [mappingJson dataUsingEncoding: NSUTF8StringEncoding];
668
+ NSError *error;
669
+ NSArray *result = [NSJSONSerialization JSONObjectWithData: jsonData options: 0 error: &error];
670
+
671
+ if (error) {
672
+ NSLog (@" Failed to parse consent mapping JSON: %@ " , error.localizedDescription );
673
+ return nil ;
674
+ }
675
+
676
+ return result;
668
677
}
669
678
670
679
- (NSDictionary *)convertToKeyValuePairs : (NSArray <NSDictionary *>*) mappings {
0 commit comments