Search code examples
iosobjective-ciphoneuitableviewmopub

Native ads in UITableView with multiple sections


I have integrated mopub-ios-sdk native ads for UITableView from this guide in my application. It works fine only for my first section, but doesn't work for other sections. On server i added repeat value. How can I fix this problem?

P.S. this pull request haven't helped for me.


Solution

  • I've found a dirty hack for current version mopub-ios-sdk(3.9.0). You can post your data(repeat value, and fixed path) on your server and then work with methods from class MPClientAdPositioning.

    - (void)addFixedIndexPath:(NSIndexPath *)indexPath;
    
    - (void)enableRepeatingPositionsWithInterval:(NSUInteger)interval;
    

    You must independently calculate indexPath for your UITableView, where you insert your native ads. Here you need these methods:

    - (NSInteger)numberOfSections;
    
    - (NSInteger)numberOfRowsInSection:(NSInteger)section;
    

    It was helpful for me. Maybe someone know better solution?