我正尝试在我的AppDelegate中接收RevMobAdsDelegate事件,但它们没有被调用。请看下面我所做的:
1)实现RevMobAdsDelegate协议:
@interface MyiOSAppAppDelegate : UIResponder <UIApplicationDelegate, RevMobAdsDelegate>2)初始化ID为的RevMobAds:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// other code here..
// Revmob initialization
[RevMobAds startSessionWithAppID: @"SECRET_APP_ID"];
// other code here..
}3)调用RevMob Ad:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[[RevMobAds session] showFullscreen];
}4)声明RevMobAdsDelegate事件:
- (void) revmobAdDidFailWithError:(NSError *)error
{
NSLog(@"1");
}
- (void) revmobAdDidReceive
{
NSLog(@"2");
}
- (void) revmobAdDisplayed
{
NSLog(@"3");
}
- (void) revmobUserClickedInTheAd
{
NSLog(@"4");
}
- (void) revmobUserClosedTheAd
{
NSLog(@"5");
}广告看起来很好,没有问题,但上面的函数都没有被调用。我也试过了
RevMobAds session.delegate = self;
但什么都没发生。这最后一行在RevMobAds Documentation中的任何地方都没有提到
但我还是试过了。有人能告诉我如何调用这些事件吗?
这里的任何帮助都将不胜感激。
发布于 2013-04-25 05:03:28
代理仅适用于对象广告,请检查API Documentation。
但是你可以使用类似这样的东西:
RevMobFullscreen *ad = [[RevMobAds session] fullscreen];
ad.delegate = self;
[ad showAd];或者你也可以使用新的“委托”块:
RevMobFullscreen *ad = [[RevMobAds session] fullscreen];
[ad loadWithSuccessHandler:^(RevMobFullscreen *fs) {
[fs showAd];
NSLog(@"Ad loaded");
} andLoadFailHandler:^(RevMobFullscreen *fs, NSError *error) {
NSLog(@"Ad error: %@",error);
} onClickHandler:^{
NSLog(@"Ad clicked");
} onCloseHandler:^{
NSLog(@"Ad closed");
}];https://stackoverflow.com/questions/16133164
复制相似问题