googleads-consent-sdk-ios icon indicating copy to clipboard operation
googleads-consent-sdk-ios copied to clipboard

Error when presenting consent-form: "invalid data. JSON Parse error: Unexpected EOF"

Open hansemannn opened this issue 6 years ago • 4 comments

A very basic example fails already:

Error Domain=Consent Code=1 "Error: invalid data. JSON Parse error: Unexpected EOF" UserInfo={NSLocalizedDescription=Error: invalid data. JSON Parse error: Unexpected EOF}

  NSURL *privacyURL = [NSURL URLwithString:@"https://example.com/privacy"];
  
  PACConsentForm *form = [[PACConsentForm alloc] initWithApplicationPrivacyPolicyURL:privacyURL];
  form.shouldOfferPersonalizedAds = YES;
  form.shouldOfferNonPersonalizedAds = YES;
  form.shouldOfferAdFree = NO;
  
  [form loadWithCompletionHandler:^(NSError * _Nullable error) {
    if (error != nil) {
      // Handle error
      return;
    }

    [form presentFromViewController:[[[TiApp app] controller] topPresentedController] dismissCompletion:^(NSError * _Nullable error, BOOL userPrefersAdFree) {
        // Handle callback
    }];
  }];

hansemannn avatar May 22 '18 10:05 hansemannn

I get the same issue with a small swift example I wrote. I installed using Cocoapods.

acushway avatar May 22 '18 11:05 acushway

Btw, this is happening for me on Android as well.

hansemannn avatar May 22 '18 14:05 hansemannn

Same issue here.

AndreFormSpicyApps avatar May 24 '18 15:05 AndreFormSpicyApps

The latest version of this SDK (v1.0.1) includes updates to provide more descriptive errors. What error are you encountering when v1.0.1. Are you ensuring to request a consent information update before attempting to display the consent form?

rampara avatar May 25 '18 01:05 rampara