【问题标题】:iAd not workingiAd 不工作
【发布时间】:2011-11-09 12:14:38
【问题描述】:

大家好,我通过下面提到的链接帮助编写了这段代码

问题是:在模拟器中只有视图是可见的。

http://www.youtube.com/watch?v=VsNGDuJ6-Fs

.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

.m 文件中的代码

#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;
}
}

并将 Ad BannerView 正确链接到 .xib 文件中的横幅

我不知道我的不足之处请朋友们帮帮我

获取此日志

iAdDemo[1696:207] ADBannerView:未处理的错误(没有委托或委托未实现 didFailToReceiveAdWithError:):错误域 = ADErrorDomain 代码 = 5“操作无法完成。横幅视图可见但确实没有内容" UserInfo=0x57180e0 {ADInternalErrorCode=5, NSLocalizedFailureReason=横幅视图可见但没有内容}

【问题讨论】:

  • 问题是广告不可见,只有视图可见并获取此日志" iAdDemo[1696:207] ADBannerView:未处理的错误(无委托或委托未实现 didFailToReceiveAdWithError:):错误域 = ADErrorDomain Code=5 "操作无法完成。横幅视图可见但没有内容" UserInfo=0x57180e0 {ADInternalErrorCode=5, NSLocalizedFailureReason=横幅视图可见但没有内容}"

标签: iphone objective-c xcode iad


【解决方案1】:

您是否为 Adview 设置了委托。

在你看来DidLoad

self.abanner.delegate=self;

只是一个提示。有效地处理您的 Adview。 在你的 Dealloc 中使用这个

abanner.delegate=nil;
[abanner release];

【讨论】:

  • 但同样的问题存在
  • 你实现了iAD框架了吗...#import
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多