无法实例化名为ADBannerView的类 [英] Could not instantiate class named ADBannerView
问题描述
我正在尝试在我的应用程序底部插入一个iad横幅,但在按照教程进行操作后仍然会出现错误。
代码如下。
i am trying to inset an iad banner at the bottom of my app but keep getting errors after following tutorials. code as follows.
@interface DMKHomeViewController (UIViewcontroller ) <ADBannerViewDelegate>{
}
@end
@implementation DMKHomeViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:1];
[UIView commitAnimations];
}
- (void)bannerView:(ADBannerView *)
banner didFailToReceiveAdWithError:(NSError *)error
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
}
我不断收到以下错误
*由于未捕获的异常'NSInvalidUnarchiveOperationException'而终止应用程序,原因:'无法实例化名为ADBannerView的类'
* 首先抛出调用堆栈:
i keep getting the following error * Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named ADBannerView' * First throw call stack:
推荐答案
请确保您已添加 iAd.framework ...
Please make sure that you have added the "iAd.framework"...
为此,请转到应用目标,常规并向下滚动,直到看到链接的框架和库。点击 +,然后选择iAd框架。请参见下面的屏幕截图...
To do this go to the "App. Target", "General" and scroll down until you see "Linked Frameworks and Libraries". Hit "+" and select the iAd framework. See screen captures below...
这篇关于无法实例化名为ADBannerView的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!