iAd 无法正常工作

发布于 2024-12-14 19:12:29 字数 1636 浏览 2 评论 0原文

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

问题是:在输出中,只有视图在模拟器中可见,没有其他内容。

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 正确链接到 aBanner,在 .xib 文件中

我不知道我缺少哪里,请帮助我朋友

获取此日志

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

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}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是偏爱你 2024-12-21 19:12:29

您是否为 Adview 设置了委托。

在你看来DidLoad

self.abanner.delegate=self;

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

abanner.delegate=nil;
[abanner release];

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];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文