2
我有橫幅廣告在我的iOS應用程序中成功地工作,但由於無法擺脫錯誤,我正在努力添加插頁式廣告的代碼: - 「沒有可見的@interface 'GADInterstitial'聲明選擇器'initWithAdUnitId:'「。除了橫幅廣告(IOS)之外,還添加了AdMob插頁式廣告
我是新手開發人員,我確信這是一個簡單的錯誤。任何人都可以幫忙嗎?
我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];
謝謝丹尼爾,你說的話有道理,我按照你的建議做了,但它沒有擺脫錯誤 - 「GADInterstitial沒有可見的@interface聲明選擇器'initWithAdUnitId:'」。 – user1238198
@ user1238198確保您的AdMob SDK版本是7.2.1或更高版本。閱讀7.2.1的發行說明[此處](https://developers.google.com/admob/ios/rel-notes) –
AdMob SDK的版本爲7.2.4,並刪除了2個頭文件導入,但「無可見」 @界面錯誤仍然存在 - 現在開始得到更多的沮喪,,,,, – user1238198