I have developed an application which recently approved from apple. But problem is iAd is not showing in iphone where as in ipad iAd is showing perfectly. At the time of development iAd is loaded and worked with test advertisement in both iPhone and iPad. But after approval from apple i have downloaded application from store noticed that iAd is not loading in iphone but it was loading in ipad. I have check other application in iphone in other application iAd is working fine but in my application iAd is not loading. So what should i do now to load the iAd in iphone.
My code that i used in the application was
-(void)showiAdInView
{
if (!appDelegate.isUpgraded) {
bannerView = [[ADBannerView alloc] init];
bannerView.delegate = self;
bannerView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.005f];
bannerView.hidden = TRUE;
bannerIsVisible = FALSE;
[self.view addSubview:bannerView];
}
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner
{
bannerIsVisible = YES;
bannerView.hidden = FALSE;
NSLog(@"ADBanner is Showing");
[self bannerViewShow];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
bannerIsVisible = FALSE;
bannerView.hidden = TRUE;
NSLog(@"ADBanner is Hidding");
NSLog(@"%@",[error description]);
[self bannerViewHide];
}
-(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication: (BOOL)willLeave
{
if ([self.captureSession isRunning]) {
[self.captureSession stopRunning];
iAdLoaded = TRUE;
}
return YES;
}
-(void)bannerViewActionDidFinish:(ADBannerView *)banner
{
UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
[self willRotateToInterfaceOrientation:interfaceOrientation duration:0.2f];
if (![self.captureSession isRunning] && iAdLoaded) {
[self.captureSession startRunning];
iAdLoaded = FALSE;
}
}
-(void)bannerViewShow
{
[bannerView setBackgroundColor:[UIColor colorWithWhite:1.0f alpha:0.005f]];
UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:MsgTextVwAdBannerFrame];
[UIView commitAnimations];
adBannerFrame = CGRectMake(0, 190, 320, 50);
clearButton.frame = CGRectMake(ClearButtonFramePotrait.origin.x, ClearButtonFramePotrait.origin.y, ClearButtonFramePotrait.size.width, ClearButtonFramePotrait.size.height);
[self.view bringSubviewToFront:bannerView];
[bannerView setFrame:adBannerFrame];
[bannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait];
}
else if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:CGRectMake(MsgTextVwAdBannerFrame.origin.x, MsgTextVwAdBannerFrame.origin.y, MsgTextVwAdBannerFrame.size.width, MsgTextVwAdBannerFrame.size.height+8)];
[UIView commitAnimations];
adBannerFrame = CGRectMake(0, 105, 470, 32);
clearButton.frame = CGRectMake(ClearButtonFrameLandscape.origin.x, ClearButtonFrameLandscape.origin.y, ClearButtonFrameLandscape.size.width, ClearButtonFrameLandscape.size.height);
[bannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
[self.view bringSubviewToFront:bannerView];
[bannerView setFrame:adBannerFrame];
}
}
else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:MsgTextVwAdBannerFrame];
[UIView commitAnimations];
adBannerFrame = CGRectMake(0, 640, 768, 50);
[bannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait];
clearButton.frame = CGRectMake(ClearButtonFrame_iPadPotrait.origin.x, ClearButtonFrame_iPadPotrait.origin.y, ClearButtonFrame_iPadPotrait.size.width, ClearButtonFrame_iPadPotrait.size.height);
[self.view bringSubviewToFront:bannerView];
[bannerView setFrame:adBannerFrame];
}
else if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:CGRectMake(MsgTextVwAdBannerFrame.origin.x, MsgTextVwAdBannerFrame.origin.y, MsgTextVwAdBannerFrame.size.width, MsgTextVwAdBannerFrame.size.height+8)];
[UIView commitAnimations];
adBannerFrame = CGRectMake(0, 325, 1024, 32);
[bannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
clearButton.frame = CGRectMake(ClearButtonFrame_iPadPotrait.origin.x, ClearButtonFrame_iPadPotrait.origin.y, ClearButtonFrame_iPadPotrait.size.width, ClearButtonFrame_iPadPotrait.size.height);
[self.view bringSubviewToFront:bannerView];
[bannerView setFrame:adBannerFrame];
}
}
}
-(void)bannerViewHide
{
[bannerView setBackgroundColor:[UIColor clearColor]];
UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:MsgTextVwFrame];
clearButton.frame = ClearButtonFramePotrait;
[bannerView setHidden:YES];
[UIView commitAnimations];
}
else if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:MsgTextVwFrame];
clearButton.frame = ClearButtonFrameLandscape;
[bannerView setHidden:YES];
[UIView commitAnimations];
}
}
else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:MsgTextVwFrame];
clearButton.frame = ClearButtonFrame_iPadPotrait;
[bannerView setHidden:YES];
[UIView commitAnimations];
}
else if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[MsgtextView setFrame:MsgTextVwFrame];
clearButton.frame = ClearButtonFrame_iPadPotrait;
[bannerView setHidden:YES];
[UIView commitAnimations];
}
}
}
iAd, overall, has a pretty low fill rate. Ad networks (iAd included) send you more ads the better your click-through-rate is; ie., the ratio of users who click ads in your app : ads you display in your app. If you have confirmed test ads were working and you've just released the app, it's entirely possibly it's just taking a little while for Apple to send you ad fils on the iPhone build. Give it a couple days and see how it goes.
Alternately, I notice your 'isUpgraded' code, there--is it possible that, on the iPhone you're testing on, you purchased the upgrade and forgot, and are now no longer returning ads?