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

Getting error on setting the rootViewController property of GADInternalBannerView before loading a request. #472

Open
syunwei opened this issue Sep 28, 2024 · 2 comments

Comments

@syunwei
Copy link

syunwei commented Sep 28, 2024

Hi
I got an error when I try to add a Banner View to my app.
The error detail is as follow:
You must set the rootViewController property of <GADInternalBannerView: 0x107c20dd0; frame = (0 0; 393 61); clipsToBounds = YES; hidden = YES; autoresize = W+H; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x600000327040>> before loading a request.

I've added the following code when initial the Banner view which fixed the error.

let scenes = UIApplication.shared.connectedScenes
let windowScene = scenes.first as? UIWindowScene
let window = windowScene?.windows.first

banner.rootViewController = window?.rootViewController
@tw-number-one
Copy link

PR: #475

@malandr2
Copy link

Hi @tw-number-one we recommend upgrading to the latest version of the Google Mobile Ads SDK, or at least version 11.0.0 because the rootViewController property is an optional property in SDK version >= 11.0.0

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

3 participants