我第一次在我的应用中使用以下代码使用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];`
问题是横幅中没有显示添加。请帮助我。
最佳答案
请尝试这样:
步骤: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];
关于ios - 如何将测试的RevMobAds转换为生产,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23672629/