Adding the Facebook Native Ad API in iOS — UITableView
Hi folks, Welcome to the world of Monetization. When I was integrating Facebook native ad with android, I could get all guidances from Facebook developer portal. But when I was trying to integrate native ads for my iOS app I couldn’t get the guidance from Facebook developer portal. They have been provided guidance to integrate native ad for UIViewcontroller not for UITableView.
Here is the link of Facebook guide.

So, I started to develop by my own. So First of all, I inserted two TableViewCells and provided “identifier” as ‘mycell’ for my default cell and as “fbnativecell” for the facebook nativead cell.


Then after my tableview data loaded into the array I inserted the one Native ad for every five rows.
Now we can take a look into the UITableView Datasource Methods as cellForRowAtIndexPath, didSelectRowAtIndexPath, heightForRowAtIndexPath and if you allow users to edit the cell in the UITableView you should customize the canEditRowAtIndexPath also.
Here is the trick we have to use to differentiate the Nativead and our cell content. Objective C offers you the method of comparing classes as following.
if([FBNativeAd class] == [Notes[indexPath.row] class]) {}
Here what happens is when the item for particular indexpath row in the Notes NSMutableArray comes as FBNativeAd this if statement should come as true. So you can implement your custom codes for the FBNativeAd.
Now Let me show how I implemented those methods.
I wanted to return height for cells but in different values for mycell and fbnativecell. So What I did in heightForRowAtIndexPath method is.

Like this I compared items in array and implemented each method.


And then If you are offering the user edit facility in the tableview you have to implement the following also.

That’s all. Now you have successfully implemented Facebook Native Ad for UITabelView.
Thank you very much for the time you spent on my article.
Catch you with next article soon.