我使用此代码首次在我的应用中使用RevMobAds
:
[RevMobAds startSessionWithAppID:@" "];
[RevMobAds session].testingMode = RevMobAdsTestingModeWithAds;
[[RevMobAds session]hideBanner];
RevMobBannerView ad = [[RevMobAds session] bannerView];
ad.delegate = self;
[ad loadAd];
ad.frame=CGRectMake(00, 430, 320, 50);
[self.view addSubview:ad];`
问题是这个横幅中没有添加任何内容。请帮助我。
答案 0 :(得分:4)
请尝试这样:
步骤:1 添加RevMovAds.framework。
步骤:2 在AppDelegate
方法导入#import <RevMobAds/RevMobAds.h>
步骤:3 添加Delegate
方法"RevMobAdsDelegate"
步骤:4 在Prefix.pch中定义#define REVMOB_ID @"52f073fa09e95bbb02000761"
(在RevMobAds网站上创建一个帐户,并为您的应用获取REVMOB_ID)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RevMobAds startSessionWithAppID:REVMOB_ID];
return YES;
}
步骤:5 声明方法
-(void)ForshowingFullScreenAds
{
RevMobFullscreen *fullscreen = [[RevMobAds session] fullscreen];
fullscreen.delegate = self;
[fullscreen loadAd];
[fullscreen showAd];
}
步骤:6 RevMobAdsDelegate
方法
- (void)revmobAdDidReceive
{
NSLog(@"[RevMob Sample App] Ad loaded.");
}
- (void)revmobAdDidFailWithError:(NSError *)error
{
NSLog(@"[RevMob Sample App] Ad failed: %@", error);
}
- (void)revmobAdDisplayed {
NSLog(@"[RevMob Sample App] Ad displayed.");
}
- (void)revmobUserClosedTheAd {
NSLog(@"[RevMob Sample App] User clicked in the close button.");
}
- (void)revmobUserClickedInTheAd {
NSLog(@"[RevMob Sample App] User clicked in the Ad.");
}
- (void)installDidReceive {
NSLog(@"[RevMob Sample App] Install did receive.");
}
- (void)installDidFail {
NSLog(@"[RevMob Sample App] Install did fail.");
}
步骤:7 导入AppDelegate
方法
步骤:8 在-(void)ViewDidLoad
AppController *App = (AppController *)[UIApplication sharedApplication].delegate;
[App ForshowingFullScreenAds];