iAd Banner无效 [英] iAd Banner is not working
本文介绍了iAd Banner无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的应用中添加横幅广告,但由于我添加了横幅广告,因此该应用无法启动。
I'm trying to get a banner in my app, but since I added the banner, the app won't start.
我收到错误消息:
终止应用程序由于未捕获的异常 'NSInvalidUnarchiveOperationException',原因: '无法实例名为ADBannerView类'
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named ADBannerView'
.h文件中的代码:
#import <iAd/iAd.h>
@interface FirstViewController : UIViewController <ADBannerViewDelegate>
{
ADBannerView *banner;
}
@property (nonatomic,assign) BOOL bannerIsVisible;
@property (nonatomic,retain) IBOutlet ADBannerView *banner;
.m文件中的代码:
@synthesize banner, bannerIsVisible;
-(void)bannerViewDidLoad: (ADBannerView *)abanner
{
if(!self.bannerIsVisible)
{
[UIView beginAnimations:@"animatedAdBannerOn" context:NULL];
banner.frame=CGRectOffset(banner.frame, 0.0, 50.0);
[UIView commitAnimations];
self.bannerIsVisible=YES;
}
}
-(void)bannerView:(ADBannerView *)aBanner
{
if(!self.bannerIsVisible)
{
[UIView beginAnimations:@"animatedAdBannerOff" context:NULL];
banner.frame=CGRectOffset(banner.frame, 0.0, -320.0);
[UIView commitAnimations];
self.bannerIsVisible=NO;
}
}
您认为有什么不对?
推荐答案
您必须将iAd.framework添加到项目中。
You must add iAd.framework into your project.
这篇关于iAd Banner无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文