AppLovin / AppLovin-MAX-SDK-iOS

84 stars 69 forks source link

Same delegate for banner and interstitials (MAAdDelegate) ? #274

Closed SmartHbdev closed 6 months ago

SmartHbdev commented 6 months ago

MAX SDK Version

12

Device/Platform Info

ios

Current Behavior

I try to implement banners and interstitials on the same time but they both use the same MAAdDelegate.

How can i write some logic and react to the different states like didLoad, didFailToLoadAd or didClick if i don't know if it's a banner or interstitial ?

Expected Behavior

There should be a MAAdBannerDelegate and MAAdInterstitialDelegate to not mix them

How to Reproduce

Just use the delegate for both sizes

Additional Info

No response

thomasmso commented 6 months ago

You can use different implementations of the MAAdDelegate, or create logic in your callbacks based on whether the ad.adUnitIdentifier property is that of your banner or interstitial.

gerchicov-vg commented 4 days ago

@thomasmso I have an additional question. Do MAInterstitialAd and MAAd (which comes from delegate callbacks) may have the same adUnitIdentifier in common only? I ask because usually in such cases MAInterstitialAd is inherited from MAAd or MAAd contains a field of MAInterstitialAd type. And therefore the check could be performed by comparing types or checking for nil.

thomasmso commented 4 days ago

MAInterstitialAd and MAAd do not share same class hierarchy. You can inspect the public API for MAAd.h but you can check its format property if it is of interstitial format as well.