- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我的 iAd 集成无法正常工作。我尝试实现全屏广告。广告出现了,但当我按下“X”按钮关闭时,它没有关闭。
也许您可以在我的代码中找到问题?我不知道要更改什么并且已投入大量时间来解决问题但没有成功。
更新
它适用于 [interstitial presentFromViewController:self];
但不适用于 [interstitial presentInView:self.view];
问题是 presentFromViewController 在 iOS 7 中已被弃用...所以我该如何更改它?
- (void)viewDidLoad
{
requestingAd = NO;
[self showFullScreenAd];
}
//Interstitial iAd
-(void)showFullScreenAd {
//Check if already requesting ad
if (requestingAd == NO) {
interstitial = [[ADInterstitialAd alloc] init];
interstitial.delegate = self;
self.interstitialPresentationPolicy = ADInterstitialPresentationPolicyManual;
[self requestInterstitialAdPresentation];
NSLog(@"interstitialAdREQUEST");
requestingAd = YES;
}//end if
}
-(void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error {
interstitial = nil;
requestingAd = NO;
NSLog(@"interstitialAd didFailWithERROR");
NSLog(@"%@", error);
}
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd {
NSLog(@"interstitialAdDidLOAD");
if (interstitialAd != nil && interstitial != nil && requestingAd == YES) {
[interstitial presentInView:self.view];
NSLog(@"interstitialAdDidPRESENT");
}//end if
}
-(void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd {
interstitial = nil;
requestingAd = NO;
NSLog(@"interstitialAdDidUNLOAD");
}
-(void)interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd {
interstitial = nil;
requestingAd = NO;
NSLog(@"interstitialAdDidFINISH");
}
提前谢谢你:)
最佳答案
对我来说,这个问题的最佳解决方案是将 [interstitial presentInView:self.view];
替换为 [_interstitialAd presentInView:_adPlaceholderView];
其中 _adPlaceholderView
是与 self.view
具有相同边界的 View ,并在显示广告之前添加。不要忘记在广告结束后删除此 View 。
完成的方法如下所示:
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd
{
if ((interstitialAd != nil) && (_interstitialAd != nil) && (_requestingAd))
{
_adPlaceholderView = [[UIView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:_adPlaceholderView];
[_interstitialAd presentInView:_adPlaceholderView];
}
}
-(void)interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd
{
_interstitialAd = nil;
_requestingAd = NO;
[_adPlaceholderView removeFromSuperview];
_adPlaceholderView = nil;
}
希望对你也有帮助。
关于iOS Interstitial iAd 不关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22464474/
我制作了一个加载苹果测试广告的测试应用程序。我想知道如何加载实时广告而不是苹果测试广告。加载实时 iAd 的机制是什么?任何人都可以在这方面帮助我吗? 问候阿卜杜勒·萨马德 最佳答案 作为docume
我刚刚将 iAd 添加到我的一个应用程序中,它工作正常,只是它在横幅 View 的顶部和底部留下了空白。有谁知道如何摆脱它? 截图如下: 最佳答案 你在使用 Storyboard吗?如果可能的话,您已
You are receiving this email because you entered into the Developer Advertising Services Agreement (
我想知道使用过 iAds 的人是否知道没有广告返回的频率 当我们收到“无广告”委托(delegate)回调时,我们正在讨论是否使用替代广告平台 - (void)bannerView:(ADBanner
我在 iAd 不支持的中国,但我想嵌入 iAd,因为我的应用程序是全局性的。我知道只有美国、英国、日本......可以展示 iAd。 如果我在中国,如何向 iAd 发送短信? 或者,如果我是位于中国的
我已经创建了一个 iOS6“单一 View ”iPhone 应用程序。 应用程序只有纵向。 我在应用程序中添加了 iAds。 我像这样向应用程序添加额外的 View : if (se
You are receiving this email because you entered into the Developer Advertising Services Agreement (
我开发了这款游戏,它运行良好,就像我想要的那样,但在我添加 iAd 横幅后,当我开始游戏时,它会正常运行大约 10 秒。然后它放大并使所有东西都变得非常大,然后它会给我这个错误: Shapes#2[7
我是第一次使用 iAd,我已成功将应用程序与 iAd 集成。现在它完成了它工作正常显示演示 iAd 横幅。如何使用 iAd 网络显示广告,我找不到任何连接 iAd 应用程序的教程。是否需要创建任何 I
如果 iAds 横幅不改变场景,我无法将 iAds 实现到游戏中,例如每次加载广告时都会抖动屏幕。请提供解决方案以阻止这种情况发生。 class GameViewController: UIViewC
我已经以这种方式构建了我的应用程序,一切似乎或多或少都正常工作。在听说 iAd 填充率极低之后,我认为这将是最好的方法,但我尝试用谷歌搜索它,但找不到其他人在他们的应用程序中像这样实现广告的记录。这是
我正在尝试在 iOS 设备上测试 iAd,2013 年的一些帖子说您需要在 iTunes Connect 中“设置 iAd 网络”。我在 Itunes connect 中看不到任何此类选项。 itun
我已经复制了 iAdSuite with Storyboards在 swift 中,iAd 在所有 View Controller 上工作正常,除了当委托(delegate)方法 bannerView
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
这仍然是一个相对较新的话题,所以不确定有多少人在 iPad (iOS4.2.1) 上实现了 iAd。 但基本上,我让 iAd 横幅以横向模式显示(并且显示正确)。唯一的问题是当我点击“测试广告”时,它
我搜索了一段时间,同时寻找有关如何在 iAds 失败时将 iAds 与 AdMobs 集成的完整指南, 我问这个问题的唯一原因是我有 iAds,我注意到 iAds 的填充率非常低,并且希望 AdMob
我们有一个支持 iAds 的应用程序。显然 iPad 版 iOs 4.2 将支持这一点,但是使用 beta SDK 进行一些测试,无法调整横幅大小以使其适合 SplitViewController 的
我在全新的项目中实现了一个非常简单的 iAd 横幅,当我运行它时,我收到错误 ERROR:无法从数据库获取接收器数据! 代码非常基本,所以我认为问题与代码无关,但我会添加它以防万一: #import
我最近更新了我的开发者成员(member)资格。我的新契约(Contract)于 5 月 19 日生效。上周我进去浏览了我的 iAd 收入,发现我所有的 iAd 应用程序都是“红色”并且没有收到广告。
Wirh SDK 4.2 和 iOS5,这让我有些困惑。在我新的基于标签栏的应用程序中,我有多个 View Controller 。我已经仔细检查并重新检查所有 iAd delgate 方法是否存在。
我是一名优秀的程序员,十分优秀!