喜所有显示试验IAD横幅我进口iAd的帧的工作和用于iAd.My样本代码如下所示如何在模拟器
h文件
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface IadTestViewController : UIViewController<ADBannerViewDelegate> {
BOOL isBannerVisible;
IBOutlet ADBannerView *banner;
}
@property(nonatomic,assign)BOOL isBannerVisible;
@property(nonatomic,retain)IBOutlet ADBannerView *banner;
@end
.m文件中实现的代码我实现委托方法
#import "IadTestViewController.h"
@implementation IadTestViewController
@synthesize banner,isBannerVisible;
- (void)viewDidLoad {
[super viewDidLoad];
isBannerVisible=NO;
bannerView=[[ADBannerView alloc]initWithFrame:CGRectZero];
bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
bannerView.delegate=self;
[self.view addSubview:bannerView];
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.isBannerVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
// Assumes the banner view is just off the bottom of the screen.
bannerView.frame = CGRectOffset(bannerView.frame, 0, -bannerView.frame.size.height);
[UIView commitAnimations];
self.isBannerVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"the failed error is %@",error);
if (self.isBannerVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// Assumes the banner view is placed at the bottom of the screen.
bannerView.frame = CGRectOffset(bannerView.frame, 0, bannerView.frame.size.height);
[UIView commitAnimations];
self.isBannerVisible = NO;
}
}
我的厦门国际银行连接的连接以及formated.still我不是我的模拟器获得的iAd的横幅和我的日志语句给我的错误是这样
Error Domain=ADErrorDomain Code=5 "The operation couldn’t be completed. Banner view is visible but does not have content" UserInfo=0x574fdd0 {ADInternalErrorCode=5, NSLocalizedFailureReason=Banner view is visible but does not have content}
我知道iAd横幅在广告为零时不可见,但我试图展示测试广告,即使这也不可能与我的程序。我不知道我犯了什么错误或我忘了执行哪一步ent.I在我们的stackoverflow.com中看到了许多类似的问题,但没有一个答案纠正我的问题。任何人都可以帮助我解决这个问题,并提供一些示例代码来显示模拟器中的TestAdd。敬请期待。
我得到了解决
我在下面的链接
Why does test iAd for barebones project not display?
请参考此[链接](http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-应用程序).............. – Nirav 2011-06-08 09:35:38
[iAd错误“广告库存不可用”]的可能重复(http://stackoverflow.com/questions/3720459/iad-error-ad-inventory-不可用) – 2013-08-27 23:52:19