【发布时间】:2015-09-10 00:11:25
【问题描述】:
我的横幅广告在我的 iOS 应用程序中成功运行,但我无法为插页式广告添加代码,因为我无法摆脱错误:-“没有可见的 @interface for 'GADInterstitial' 声明选择器 'initWithAdUnitId:'” .
我是一名新手开发人员,我确信这是我犯的一个简单错误。有人可以帮忙吗?
我的 viewcontroller.h 看起来像这样:-
#import <UIKit/UIKit.h>
#import "GADBannerView.h"
#import "GADRequest.h"
@import GoogleMobileAds;
@class GADBannerView, GADRequest;
@class GADInterstitial, GADRequest;
@interface GenTeamViewController : UIViewController
<GADBannerViewDelegate, GADInterstitialDelegate> {
GADBannerView *bannerView_;
GADInterstitial *interstitialView_;
NSString *teamName;
UILabel *teamLabel;
}
@property(nonatomic, strong) GADInterstitial *interstitial;
@property (nonatomic, strong)GADBannerView *bannerView;
-(GADRequest *)createRequest;
,
,
,
@end
视图控制器 .m 看起来像:-
- (void)viewDidLoad
{
[super viewDidLoad];
self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:@"xxxxxxxxx"];
GADRequest *request = [GADRequest request];
// Requests test ads on test devices.
request.testDevices = @[@"xxxxxxxxx"];
[self.interstitial loadRequest:request];
【问题讨论】:
标签: ios admob interstitial