@@ -267,7 +267,7 @@ - (void)initSdk:(FlutterMethodCall *)call withResult:(FlutterResult)result {
267267 [adjustConfig disableIdfvReading ];
268268 }
269269 }
270-
270+
271271 // SKAdNetwork attribution
272272 if ([self isFieldValid: isSkanAttributionEnabled]) {
273273 if ([isSkanAttributionEnabled boolValue ] == NO ) {
@@ -419,7 +419,7 @@ - (void)processDeeplink:(FlutterMethodCall *)call withResult:(FlutterResult)resu
419419 if (urlString == nil ) {
420420 return ;
421421 }
422-
422+
423423 NSURL *url = [NSURL URLWithString: urlString];
424424 ADJDeeplink *deeplink = [[ADJDeeplink alloc ] initWithDeeplink: url];
425425 [Adjust processDeeplink: deeplink];
@@ -456,12 +456,12 @@ - (void)trackAdRevenue:(FlutterMethodCall *)call withResult:(FlutterResult)resul
456456 if ([self isFieldValid: adRevenueNetwork]) {
457457 [adjustAdRevenue setAdRevenueNetwork: adRevenueNetwork];
458458 }
459-
459+
460460 // ad revenue unit
461461 if ([self isFieldValid: adRevenueUnit]) {
462462 [adjustAdRevenue setAdRevenueUnit: adRevenueUnit];
463463 }
464-
464+
465465 // ad revenue placement
466466 if ([self isFieldValid: adRevenuePlacement]) {
467467 [adjustAdRevenue setAdRevenuePlacement: adRevenuePlacement];
@@ -576,13 +576,19 @@ - (void)getAttribution:(FlutterMethodCall *)call withResult:(FlutterResult)resul
576576 [self addValueOrEmpty: attribution.costType withKey: @" costType" toDictionary: dictionary];
577577 [self addNumberOrEmpty: attribution.costAmount withKey: @" costAmount" toDictionary: dictionary];
578578 [self addValueOrEmpty: attribution.costCurrency withKey: @" costCurrency" toDictionary: dictionary];
579- NSData *dataJsonResponse = [NSJSONSerialization dataWithJSONObject: attribution.jsonResponse
579+
580+ // Add nil check before serializing jsonResponse
581+ if (attribution.jsonResponse != nil ) {
582+ NSData *dataJsonResponse = [NSJSONSerialization dataWithJSONObject: attribution.jsonResponse
580583 options: 0
581584 error: nil ];
582- NSString *stringJsonResponse = [[NSString alloc ] initWithBytes: [dataJsonResponse bytes ]
585+ NSString *stringJsonResponse = [[NSString alloc ] initWithBytes: [dataJsonResponse bytes ]
583586 length: [dataJsonResponse length ]
584587 encoding: NSUTF8StringEncoding];
585- [self addValueOrEmpty: stringJsonResponse withKey: @" jsonResponse" toDictionary: dictionary];
588+ [self addValueOrEmpty: stringJsonResponse withKey: @" jsonResponse" toDictionary: dictionary];
589+ } else {
590+ [self addValueOrEmpty: @" " withKey: @" jsonResponse" toDictionary: dictionary];
591+ }
586592 result (dictionary);
587593 }];
588594}
@@ -687,7 +693,7 @@ - (void)verifyAppStorePurchase:(FlutterMethodCall *)call withResult:(FlutterResu
687693 if (verificationResult == nil ) {
688694 result (dictionary);
689695 }
690-
696+
691697 [self addValueOrEmpty: verificationResult.verificationStatus
692698 withKey: @" verificationStatus"
693699 toDictionary: dictionary];
@@ -788,7 +794,7 @@ - (void)verifyAndTrackAppStorePurchase:(FlutterMethodCall *)call withResult:(Flu
788794 if (verificationResult == nil ) {
789795 result (dictionary);
790796 }
791-
797+
792798 [self addValueOrEmpty: verificationResult.verificationStatus
793799 withKey: @" verificationStatus"
794800 toDictionary: dictionary];
0 commit comments