Reputation: 242
Hi All I have written this code by taking help with this below mention link
Problem is: on out put only view is visible in the simulator nothing else.
http://www.youtube.com/watch?v=VsNGDuJ6-Fs
Code is as follows in .h
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface RootViewController : UIViewController<ADBannerViewDelegate>{
IBOutlet ADBannerView *aBanner;
}
@property (nonatomic, retain) ADBannerView *aBanner;
@property (nonatomic, assign) BOOL bannerIsVisible;
@end
code in .m file
#import "RootViewController.h"
@implementation RootViewController
@synthesize aBanner,bannerIsVisible;
#pragma mark ADBannerViewDelegate
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
if (!self.bannerIsVisible){
[UIView beginAnimations:@"animationAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
if (self.bannerIsVisible){
[UIView beginAnimations:@"animationAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
and properly link the Ad BannerView to aBanner, in .xib file
i don't know where i am lacking please help me out Friends
Getting this log
iAdDemo[1696:207] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=5 "The operation couldn’t be completed. Banner view is visible but does not have content" UserInfo=0x57180e0 {ADInternalErrorCode=5, NSLocalizedFailureReason=Banner view is visible but does not have content}
Upvotes: 0
Views: 761
Reputation: 16563
Have you set the delegate for the Adview.
In your viewDidLoad
self.abanner.delegate=self;
Just a hint. Handle your Adview efficiently. In your Dealloc use this
abanner.delegate=nil;
[abanner release];
Upvotes: 0