googleads/googleads-consent-sdk-ios

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

hansemannn opened this issue · 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
    }];
  }];

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

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

Same issue here.

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?