xamarin / GoogleApisForiOSComponents

MIT License
225 stars 161 forks source link

Mobile Ads SDK (iOS) versioning error - Xamarin.Firebase.iOS.Admob plugin #520

Open blmiles opened 2 years ago

blmiles commented 2 years ago

Hello,

Methinks someone should update this plugin library as it fails in the app (iOS Xamarin) citing wrong version of the Mobile Ads SDK.

This is what I get -

2022-01-21 13:56:38.844 MyCompany[3831:1156576] Google:HTML You are currently using version 7.66.0 of the SDK. Please consider updating your SDK to the most recent SDK version (8.13.0) to get the latest features and bug fixes. The latest SDK can be downloaded from https://goo.gl/UoiJ8F. A full list of release notes is available at https://developers.google.com/admob/ios/rel-notes.

@dmariogatto, can you comment on this at all?

@mattleibow, can you comment on this at all?

This really stops progress on implementing AdMob into our Xamarin.Forms app. I'm sure we're no the only ones either. Wondering if the Admob plugin can just be rebuilt with the latest Google SDK or if there are code fixes/mods necessary if targeting the latest SDK....

Any feedback?

pboisso commented 2 years ago

+1 vote for this update as well.

dmariogatto commented 2 years ago

@blmiles I've just helped out with keeping the bindings up-to-date. I'm not a project maintainer and I don't have any extra knowledge on the release timeline beyond what is public on the repo.

I personally use AdMob and have been using a custom nuget built from my PR (#501) while I wait for an offical release.

blmiles commented 2 years ago

@dmariogatto , thanks for the response Daniel. I've pulled code but there seems to be too many external references to build...

If possible, could you tag whomever IS responsible for getting an update out. There are a lot of people awaiting an update, you and I included, and it's time MS and the Xamarin team get it done.

Thanks

blmiles commented 2 years ago

Apart from needing the Xamarin.Firebase.iOS.Admob plugin updated with the latest Google SDK, here's minor work-around in the AdmobViewRenderer as cited in the samples...

When navigating TO various pages, we're not seeing any issues or breaks, however, navigating BACK to a previous page or the main page in a Xamarin.Forms app was causing a crash and the App quits.

This is because the "Element" in the CreateBannerView() method is null and the AdUnitId cannot be set.

I simply set the AdUnitId directly in the CreateBannerView method and this works fine for now. Obviously I can move the id string into the plist or wherever else you store string vars/consts.

` private BannerView CreateBannerView() { bannerView = new BannerView(AdSizeCons.SmartBannerPortrait) { AdUnitId = "ca-app-pub-[your adunitId here]", RootViewController = GetVisibleViewController() };

            bannerView.LoadRequest(GetRequest());

            Request GetRequest()
            {
                var request = Request.GetDefaultRequest();
                return request;
            }

            return bannerView;

    }

`

Not tried the Android implementation yet but this makes all GoogleAds work in iOS Xamarin.Forms app.

Simple, but I hope that helps someone...

Thanks

Mataboge commented 2 years ago

Finally somebody complained!

dmariogatto commented 2 years ago

@blmiles

AbMob 8.13 is now on NuGet.

tipa commented 2 years ago

The new package is missing the stuff from Google.MobileAds.Consent. Was the ConsentForm removed from the library or is it just due to missing bindings? Seems like I am stuck on v7.66 for now.

dmariogatto commented 2 years ago

@tipa UMP was removed from the AdMob package and moved to a separate binding.

It should've been released, however, looks like the package name is already in use (you might be able to use that package for the time being).

@Redth @SotoiGhost

blmiles commented 2 years ago

Hi, thanks @dmariogatto

Unfortunately, probably need to roll back... I updated to the new release, cleaned solution, rebuild and I get this error:

Severity Code Description Project File Line Suppression State Error Can't resolve the reference 'System.IntPtr ObjCRuntime.DisposableObject::get_Handle()', referenced from the method 'System.Void Google.MobileAds.AdLoaderDelegateWrapper::DidFailToReceiveAd(Google.MobileAds.AdLoader,Foundation.NSError)' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. mycompany.iOS C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 254

Any ideas? Anyone?

tipa commented 2 years ago

I am in the process of porting my Xamarin.iOS app to .NET for iOS and I am having problems with this again. I can use the stuff from the Google.MobileAds namespace, but the Google.UserMessagingPlatform namespace is not available, event though I referenced the UserMessagingPlatform Nuget. Perhaps that package hasn't been built for the net6.0-ios target yet like the MobileAds package has?

Edit: Just realised that the most recent version for UserMessagingPlatform on Nuget is 1.1.0.1, is that the one we are supposed to use? Screenshot 2022-08-12 at 12 26 54

Even then, the build fails with: /Users/tp/GitHub/atomicclock/AtomicClock.iOS/obj/MyApp.csproj.nuget.g.targets(5,5): Error MSB4024: The imported project file "/Users/tp/.nuget/packages/xamarin.google.ios.usermessagingplatform/1.1.0.1/buildTransitive/Xamarin.Google.iOS.UserMessagingPlatform.targets" could not be loaded. The '_GoogleUserMessagingPlatformAssemblyName' start tag on line 3 position 6 does not match the end tag of '_GoogleMobileAdsAssemblyName'. Line 3, position 132. (MSB4024) (MyApp)

I assume that is a bug here. Does anyone has experience on how to build this project locally after fixing this?

tipa commented 1 year ago

@Redth are the UMP bindings still supported and if so, can we expect working bindings and a new Nuget version at some point or should we expect this binding to be deprecated and not supported by Microsoft?

pboisso commented 10 months ago

@tipa I'm interested to know if you've been able to successfully have UMP working on Xamarin.iOS?

tipa commented 10 months ago

@pboisso Yes I have, see here