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

Null reference on iOS when adding banner to page #134

Open
GreenleafDk opened this issue Jun 2, 2023 · 4 comments
Open

Null reference on iOS when adding banner to page #134

GreenleafDk opened this issue Jun 2, 2023 · 4 comments

Comments

@GreenleafDk
Copy link

MTAdmob 1.9.0.6
Xamarin forms 5.0.0.2545
iOS 15.7.5

Works fine on Android but crashes for iOS with
ObjectReference not set to an instance of an object.mscorelib at Google.MobileAds.AdSizeCons.get_Banner()
at MarcTron.Plugin.Renderers-AdViewRenderer.GetAdSize

Basic repro case:

New empty page

public PageName()
{
InitializeComponent() ;
MYAdView adv = MTAdView();
StackLayoutOnPage.Children.Add(adv);
}

On adding to the UI, the null reference is thrown.
Tried setting this up in multiple ways, in xaml and in code, with and without setting the properties for banner type, size, addId etc. Always fails on this basic initial rendering. Same settings work fine without issue for android.

@peterrexj
Copy link

peterrexj commented Oct 29, 2023

Hi @GreenleafDk, were you able to resolve this issue, I have been battling for a few days now but haven't got into any solution yet. Much appreciated if you have any comments, please

@GreenleafDk
Copy link
Author

Yes and no. This was tested, and failing, on a physical ipad and iphone, both a bit dated, and it failed when debugging locally (both debug and release)... but when making a release build for ios store and installing from there, and then running, on those same two devices, there was no issue. This may or may not be helpful for you, and I honestly don't understand exactly what is going on, but the issue became a bit of a non issue that way. Same was happened with an issue with microsoft appcenter, which crashed on null exception in test (debug and release builds), but worked fine when installing from store and then running.
If this makes sense to you, or anyone else, please do tell.

@peterrexj
Copy link

Thanks for your response @GreenleafDk, you are lucky to get it working, for me it's crashing on physical device both from local and from the store (returning null) but works perfectly on the simulator. I might have to disable it for now unless @marcojak comes out with any solution.

@marcojak
Copy link
Owner

Hi, let me have a look if I can identify the issue and release a new version that fixes the issue.

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