Xamarin.iOS。 Appodeal。 NSInvalidArgumentException 原因:-[APDImage imageUrl]

Xamarin.iOS. Appodeal. NSInvalidArgumentException Reason: -[APDImage imageUrl]

Xamarin.iOS。 Appodeal。 Foundation.MonoTouchException: Objective-C 抛出异常。名称:NSInvalidArgumentException 原因:-[APDImage imageUrl]:发送到实例 0x280002420

的无法识别的选择器

class NativeAdDelegate : APDNativeAdLoaderDelegate
{
    NativeAdView _nativeAdView;

    public NativeAdDelegate(NativeAdView nativeAdView) =>
        _nativeAdView = nativeAdView;

    public override void NativeAdLoader(APDNativeAdLoader loader, NSError error) =>
        Console.WriteLine("APDNativeAd DidFailToLoadWithError");

    public override void NativeAdLoader(APDNativeAdLoader loader, NSArray nativeAds) =>
        _nativeAdView.DidLoad(nativeAds.GetItem<APDNativeAd>(0));
}

nativeAds.GetItem(0)

我有标题和描述文字,但没有图片。我在 nativeAds.GetItem(0).IconImage.ImageUrl.

中遇到异常

图像是 required.Otherwise 属性 ImageUrl 将 return 为空值,这将导致问题。

public override void DidLoadNativeAds(APDNativeAdLoader loader, APDNativeAd[] nativeAds)
  {
      _nativeAdView.DidLoad(nativeAds[0]);
  }     

详情请参考here

APDImage * mainImage - 图像的位图。广告对象同时包含图标和图像。必须至少使用这些元素之一。

Deprecated method.

详情请参考here

public override void NativeAdLoader(APDNativeAdLoader loader, NSArray nativeAds)
{
    _nativeAdView.DidLoad(nativeAds.GetItem<APDNativeAd>(0));
}

public void DidLoad(APDNativeAd nativeAd)
{
     this.nativeAd = nativeAd;
     UIView view = new UIView();
     view.Frame = new System.Drawing.Rectangle(10, 30, 200, 200);
     view.BackgroundColor = UIColor.FromRGB(96, 36, 36);
     View.AddSubview(view);
     this.nativeAd.AttachToView(view, UIApplication.SharedApplication.Windows[0].RootViewController);
     this.myMediaView.SetNativeAd(this.nativeAd, this);
     View.AddSubview(this.myMediaView); 
}