我正在尝试将 AppLovin 横幅广告集成到我的通用应用程序中。在 iPhone 上,它运行良好。但是在 iPad 上,在用户离开/关闭带有横幅的视图后,应用程序会崩溃。
这是显示横幅广告的代码:
// Create new AdView
adView = [[ALAdView alloc] initBannerAd];
//
// (Optional) Position the ad at the bottom of screen. By default
// it would be postitioned at (0,0)
//
adView.frame = CGRectMake( 0,
self.view.frame.size.height - adView.frame.size.height,
adView.frame.size.width,
adView.frame.size.height );
adView.autoresizingMask =
UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleRightMargin;
// (Mandatory) Add the ad into current view
[self.view addSubview:adView];
// (Mandatory) Trigger loading of the new ad.
[adView loadNextAd];
如果我注释掉 addSubview 调用,则不会发生崩溃。似乎添加的子视图没有被统一化或其他东西。
非常感谢您的帮助!