Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS error when requestConsentInfo again to change consent preferences #276

Open
basvdijk opened this issue Aug 30, 2023 · 5 comments
Open

Comments

@basvdijk
Copy link

basvdijk commented Aug 30, 2023

Describe the bug

Ask consent on iOS via the code in the README.MD:

import { AdMob, AdmobConsentStatus, AdmobConsentDebugGeography } from '@capacitor-community/admob';

async showConsent() {
  const consentInfo = await AdMob.requestConsentInfo();

  if (consentInfo.isConsentFormAvailable && consentInfo.status === AdmobConsentStatus.REQUIRED) {
    const {status} = await AdMob.showConsentForm();
  }
}
  • The first time the consent window is shown perfectly
  • Opening the consent form for the second time to change preferences gives this error (on Android it works fine)
⚡️  To Native ->  AdMob requestConsentInfo 95686914
⚡️  TO JS {"isConsentFormAvailable":true,"status":"OBTAINED"}
⚡️  To Native ->  AdMob showConsentForm 95686915
⚡️  TO JS {"status":"OBTAINED"}
2023-08-30 08:28:02.759274+0200 App[5237:1333110] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2023-08-30 08:28:02.759343+0200 App[5237:1333110] [ProcessSuspension] 0x10f022400 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=5246, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2023-08-30 08:28:02.763514+0200 App[5237:1333110] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2023-08-30 08:28:02.764039+0200 App[5237:1333110] [ProcessSuspension] 0x10f022460 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess Suspended Assertion' for process with PID=5246, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}

Adding this part did not make difference:

  const consentInfo = await AdMob.requestConsentInfo({
    debugGeography: AdmobConsentDebugGeography.EEA,
    testDeviceIdentifiers: ['YOUR_DEVICE_ID']
  });

To Reproduce

  • Create an Capacitor app with AdMob
  • Create a button which runs the consent code from the README.MD
  • When prompted don't give consent to anything
  • Click the button for consent dialog again

Expected behavior

  • The consent widow to show so that the user can change its consent preferences.

Smartphone (please complete the following information):

  • Device: iPhone
  • OS: 16.6

Additional info
This article https://developer.apple.com/forums/thread/709919 says you have to turn on these capabilities in your app:

image

This did not make a difference

@basvdijk
Copy link
Author

basvdijk commented Nov 2, 2023

@rdlabo any update on this? In the latest release still nothing happens when calling await AdMob.showConsentForm(); in iOS in order to change an earlier set preference. In Android there is no issue.

@distante
Copy link
Contributor

distante commented Nov 2, 2023

I do not really use iOS but in android you first HAVE to get the consent info.

If you reset the consent. Then you have to call get consent before calling show form.

(sorry for the formating , I am on my phone)

@basvdijk
Copy link
Author

basvdijk commented Nov 2, 2023

@distante Thanks for your reply. The first consent works like a charm on both iOS and Android. However if a user wants to change their consent preferences I can call await AdMob.showConsentForm(); again on Android and the consent popup is shown. On iOS I see that Capacitor requests the consent popup, but this function returns immediately without showing the popup.

⚡️  TO JS {"isConsentFormAvailable":true,"status":"OBTAINED"}
⚡️  To Native ->  AdMob showConsentForm 19231150
⚡️  TO JS {"status":"OBTAINED"}

@kjeacle
Copy link

kjeacle commented Dec 24, 2023

I'm seeing the same thing on iOS.

The native SDK documentation recommends calling showPrivacyOptionsForm() on Android and presentPrivacyOptionsFormFromViewController() on iOS when a user needs to update consent.

README says to use resetConsentInfo() but that calls reset() and the SDK says that's only for debugging.

@rangloe
Copy link

rangloe commented Jan 31, 2024

@basvdijk I had the same problem, and I solved it by first calling the reset method:

try {
 await AdMob.resetConsentInfo();
 await AdMob.requestConsentInfo();
 await AdMob.showConsentForm();
} catch (error) {
 console.error('Error during consent process:', error);
} finally {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants