admob-plus / admob-plus

Trustable AdMob Plugin for Cordova, Capacitor, Ionic, React Native
https://admob-plus.github.io
MIT License
361 stars 150 forks source link

Error uncaught No available form can be built. #638

Open merbin2012 opened 4 months ago

merbin2012 commented 4 months ago

I think you need to update your sample code.

"Uncaught No available form can be built." this error showing, if we call "await consent.loadAndShowIfRequired()" method before execute the following method "await consent.requestInfoUpdate()"

I think needs to remove the following lines

const consentStatus = await consent.getConsentStatus()
  if (consentStatus === consent.ConsentStatus.Required)

Kindly confirm once if am I right or wrong. Thank ou

sfeast commented 4 months ago

As @merbin2012 mentions, existing sample code here shows:

const consentStatus = await consent.getConsentStatus()
  if (consentStatus === consent.ConsentStatus.Required) {
    await consent.requestInfoUpdate()
  }

  await consent.loadAndShowIfRequired()

which only calls await consent.requestInfoUpdate() when consentStatus === consent.ConsentStatus.Required, however on iOS I get the below error if not always first calling

await consent.requestInfoUpdate()

before calling:

await consent.loadAndShowIfRequired()

error:

Unhandled Promise Rejection: Consent form unavailable. Request a consent form using [UMPConsentInformation.sharedInstance requestConsentInfoUpdateWithParameters:completionHandler:]