具有多个部分的 UITableView 中的原生广告

Native ads in UITableView with multiple sections

我已经在我的应用程序中集成了来自此 guide 的 UITableView 的 mopub-ios-sdk 原生广告。它仅适用于我的第一部分,但不适用于其他部分。在服务器上我添加了重复值。我该如何解决这个问题?

P.S。这 pull request 对我没有帮助。

我发现了当前版本 mopub-ios-sdk(3.9.0) 的肮脏黑客。您可以 post 服务器上的数据(重复值和固定路径),然后使用 class MPClientAdPositioning 中的方法。

- (void)addFixedIndexPath:(NSIndexPath *)indexPath;

- (void)enableRepeatingPositionsWithInterval:(NSUInteger)interval;

您必须独立计算您的 UITableView 的 indexPath,您将在其中插入原生广告。这里你需要这些方法:

- (NSInteger)numberOfSections;

- (NSInteger)numberOfRowsInSection:(NSInteger)section;

对我很有帮助。也许有人知道更好的解决方案?