我已经实现了谷歌admob sdk 6.12,广告出现了,一切都运行完美,几天后谷歌更新了sdk 7,再次我导入新的sdk但这次我无法使用#import "GADInterstitial.h"每次我得到错误#import"GADInterstitial.h"没有找到,导入所有框架但没有成功,如果我使用@class GADInterstitial.h;和使用此代码没有广告出现
- (void)viewDidLoad {
[super viewDidLoad];
self.interstitial = [[GADInterstitial alloc] init];
self.interstitial.adUnitID = Interstical_Unit_id;
GADRequest *request = [GADRequest request];
// Requests test ads on simulators.
request.testDevices = @[ GAD_SIMULATOR_ID ];
[self.interstitial loadRequest:request];
}
- (void)gameOver {
if ([self.interstitial isReady]) {
[self.interstitial presentFromRootViewController:self];
}
// Rest of game over logic goes here.
}
Run Code Online (Sandbox Code Playgroud)
您不再需要导入标题,只需使用它即可
@import GoogleMobileAds
Run Code Online (Sandbox Code Playgroud)
您也不需要链接其他框架或将-ObjC添加到链接器标志.
| 归档时间: |
|
| 查看次数: |
903 次 |
| 最近记录: |