marcojak / MTAdmob

Admob plugin for Xamarin Android and iOS
https://www.xamarinexpert.it/admob-made-easy/
160 stars 26 forks source link

Works perfectly in Android project, but throws a NotImplementedException in iOS project #138

Open ShakiFanatico opened 11 months ago

ShakiFanatico commented 11 months ago

Hello there!

I've created a mobile game using MonoGame and recently began integrating AdMob. As far as I understand, MonoGame utilizes Xamarin Native under the hood. The integration process on Android has been smooth – simply adding the NuGet package, initializing it in the main Activity, updating the manifest, and it's good to go. I want to express my gratitude for this incredibly easy and user-friendly plugin!

However, when attempting exactly the same integration on the iOS version, I encounter a NotImplementedException: "This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."

It seems there might be some distinctions between the Android and iOS projects. To provide more context (if it's relevant at all), my MonoGame project targets net8.0-android34.0 for Android (which works like a charm), and for iOS, it targets net8.0-ios16.1.

Could you shed some light on what might be going wrong with iOS? Despite the exception message, the NuGet package is in fact referenced in the main iOS project, and I've also added Xamarin.Google.iOS.MobileAds.

Thanks!

marcojak commented 9 months ago

I'm not actually sure why you are receiving this error. Usually it means that the iOS version of the plugin is not correctly referenced (for example if you install it only in your xamarin main and android projects and not iOS.

I think the issue might be that this plugin is for Xamarin and targets netstandard2.0;xamarinios10;monoandroid13.0; I'm actually surprised that it works with your project targeting net8 (probably it's backwards compatible).

Maybe you can share with me your Monogame project or if you cannot do it, you could create an almost empty project that compiles with your same options)