I had developed a cross platform app using Xamarin Forms which is working fine. Now, I want to display ads in the app so I read some articles and have gone through some youtube vidoes https://www.youtube.com/watch?v=fENpVR0rlO8. Most of the videos only show you how to implement custom renderer for FAN in Andriod but I have not found any artcile or video that can guide me how to implement custom renderer for FAN in iOS.
Can any one please suggest what should I do?
Thanks.
I have found a solution to my problem. Here is what I had done in order to make it work. May be it can help some one like me
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Contexts;
using System.Text;
using Facebook.AudienceNetwork;
using CoreGraphics;
using Foundation;
using UIKit;
using VRunTracker;
using VRunTracker.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(FacebookAdsControl), typeof(FacebookAdRenderer))]
namespace VRunTracker.iOS
{
public class FacebookAdRenderer : ViewRenderer<FacebookAdsControl,UIView>
{
public FacebookAdRenderer()
{
}
private FacebookAdsControl AdsControl => (FacebookAdsControl) Element;
protected override void OnElementChanged(ElementChangedEventArgs<FacebookAdsControl> e)
{
base.OnElementChanged(e);
if (AdsControl == null)
{
return;
}
var rootVC = UIApplication.SharedApplication.Windows[0].RootViewController;
AdView adView = new AdView(AdsControl.PlacementId, AdSizes.BannerHeight50, rootVC);
adView.LoadAd();
SetNativeControl(adView);
}
}
}
Hope that can help others. Riy