Ios iPad上的AppLovin横幅广告崩溃
我正在尝试将AppLovin横幅广告集成到我的通用应用程序中。在iPhone上,它工作正常。但在iPad上,当带有横幅的视图被用户留下/删除后,应用程序崩溃 下面是显示横幅广告的代码:Ios iPad上的AppLovin横幅广告崩溃,ios,ipad,uitableview,uiviewcontroller,applovin,Ios,Ipad,Uitableview,Uiviewcontroller,Applovin,我正在尝试将AppLovin横幅广告集成到我的通用应用程序中。在iPhone上,它工作正常。但在iPad上,当带有横幅的视图被用户留下/删除后,应用程序崩溃 下面是显示横幅广告的代码: // Create new AdView adView = [[ALAdView alloc] initBannerAd]; // // (Optional) Position the ad at the bottom of screen. By default // it would be postition
// 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调用,则不会发生崩溃。似乎添加的子视图没有得到统一化或其他东西
非常感谢你的帮助 问题在于未指定父控制器。添加
adView.parentController = self;
解决了这个问题。以下是最终代码:
// Create new AdView
adView = [[ALAdView alloc] initBannerAd];
adView.parentController = self;
// (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];
对于未来的用户。。。要在上面移动它。。。adView.frame=CGRectMake(0,0,adView.frame.size.width,adView.frame.size.height);“initBannerAd”现在标记为已弃用。。。什么是更新代码?