Closed kisimediaDE closed 8 months ago
I tried to remove ios folder and then run npx cap add ios again. but same error message. (instead of only do a sync)
Same issue for my app
By looking at the code it seems that the reason is the following function returning nil
func getRootVC() -> UIViewController? { var window: UIWindow? = UIApplication.shared.delegate?.window ?? nil if window == nil { let scene: UIWindowScene? = UIApplication.shared.connectedScenes.first as? UIWindowScene window = scene?.windows.filter({$0.isKeyWindow}).first if window == nil { window = scene?.windows.first } } return window?.rootViewController }
I had the same problem and I solved it like below:
In my case I thought I was supposed to call AdMob.requestConsentInfo()
and AdMob.showConsentForm()
first and the depending on the response finally call AdMob.initialize()
. But it seems like you first need to call AdMob.initialize()
and then the consent stuff.
Not sure I'm doing it right but then it worked for me.
I moved down my logic so I only call AdMob.showBanner()
when a consent is obtained, so no banners is shown before consent is made.
Thanks for issue.Perhaps there is a problem with the order of method calls. Please refer to the following to execute.
https://github.com/capacitor-community/admob/commit/21d0302426cafcc2464203cb9828dd31535bf2fb
@rdlabo thanks for the update! Tested it now and everything is working well. THANK YOU!!!!
Describe the bug Ask consent on iOS via the code
I get the following message in Xcode when I try to run the app:
The app is already deployed to the App Store but no Consent Window is shown and the app don't show ads anymore.
Adding this part did not make difference:
To Reproduce Steps to reproduce the behavior:
Expected behavior The consent window to show and then display ads
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context "@capacitor-community/admob": "^5.1.1"