如果在未投放广告时隐藏iAd横幅广告? [英] How do I hide iAd banners when no ads are being served?

查看:158
本文介绍了如果在未投放广告时隐藏iAd横幅广告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供这方面的帮助?我刚收到来自苹果的反馈建议我的应用程序不能被接受,因为它包含在没有广告投放时仍然可见的adbanners,麻烦是我不能弄清楚该怎么做以防止此问题。

Anyone able to offer a little help on this? I just received feedback from Apple advising my app could not be accepted because it contained adbanners that were still visible when no ads were being served, trouble is I can't figure out quite what to do to prevent this problem.

[QUOTE]


我们已完成您的
申请的审查;但是,我们不能将
这个版本发布到App Store,因为当
广告内容不可用时,
会显示一个空的iAd横幅。当广告内容不是由iAd提供的
时,应用程序中的
横幅应隐藏
。我们已经包括了
的额外细节,以帮助
解释这个问题。我们希望您
考虑修改您的申请并重新提交

We've completed the review of your application; however, we cannot post this version to the App Store because it displays an empty iAd banner when ad content is not available. The banner within the app should be hidden whenever ad content is not being served by iAd. We have included additional details below to help explain the issue. We hope that you'll consider revising and resubmitting your application.

处理广告内容为
的情况,您将需要
实现一个横幅视图委托。为了方便,
示例代码片段包含在此处
。另外,
您可能希望查看iAd
编程指南中关于
详细信息的
使用横幅视图部分:
https://developer.apple.com/iphone/prerelease/

To handle the case where ad content is not available, you will need to implement a banner view delegate. An example code snippet is included here for your convenience. Additionally, you may wish to review the section "Working with Banner Views" of the iAd Programming Guide for specific details: https://developer.apple.com/iphone/prerelease/library/documentation/UserExperience/Conceptual/iAd_Guide/WorkingwithBannerViews/WorkingwithBannerViews.html

横幅查看代理删除
横幅视图当广告是
不可用:

Banner View Delegate to Remove a Banner View When Advertisements are Not Available:



 - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
 {
  if (self.bannerIsVisible)
   {
       [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
 // assumes the banner view is at the top of the screen.
       banner.frame = CGRectOffset(banner.frame, 0, -50);
       [UIView commitAnimations];
       self.bannerIsVisible = NO;
   }
 }

现在我正在努力的是做什么有了这段代码,当我尝试把它放在它只是抛出了几个红色的错误,所以我来寻求建议,任何人都可以帮助我在这里?

Now what I'm struggling withs is what to do with that code, when I've tried putting it in it just throws out several red errors so I come seeking advice, anyone able to help me out here?

编辑:
根据海报请求的主视图控制器代码

Main viewcontroller Code as requested by a poster

    //
//  MainViewController.m
//  GBSoundboard4
//
//  Created by David Clarke on 19/06/2010.
//  Copyright __MyCompanyName__ 2010. All rights reserved.
//

#import "MainViewController.h"
#import <AVFoundation/AVAudioPlayer.h>

@implementation MainViewController
-(IBAction)goodafternoon {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"goodafternoon" ofType:@"wav"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    [theAudio play];
}

-(IBAction)jollygood {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"jollygood" ofType:@"wav"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    [theAudio play];
}
-(IBAction)playSound {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"goodmorning" ofType:@"wav"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];

    [theAudio play];
}

-(IBAction)upgrade {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/gb/app/the-great-british-soundboard/id376263018?mt=8"]];
}



/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/


- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {

    [self dismissModalViewControllerAnimated:YES];
}


- (IBAction)showInfo:(id)sender {    

    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc. that aren't in use.
}


- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/


- (void)dealloc {
    [super dealloc];
}


@end


推荐答案

有一个如何在WWDC 2010会话视频112中实现这个示例。如果您注册了iPhone开发人员程序,您可以从iTunes大学下载,如下所述。

There is a GREAT example of how to implement this in WWDC 2010 session video 112. If you are enrolled in the iPhone developer program, you can download it from iTunes University, as described below.

假设您在Apple开发者计划中,您收到了一封标题为WWDC for everyone的电子邮件。按照电子邮件中的链接,直到您访问iTunes大学。然后按照框架的链接,选择会话112.我认为实施大约在25分钟。

Assuming you are in the Apple Developer Program, you received an Email entitled "WWDC for everyone." Follow the links in that Email until you get to iTunes University. Then follow the link for frameworks, and pick session 112. I think the implementation is at approximately the 25 minute mark.

这篇关于如果在未投放广告时隐藏iAd横幅广告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆