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]
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.
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?
EDIT: 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