在Cordova中为iOS打开后关闭AdMob Ads
当我将bannerView设置为隐藏时,仍有一个白色框覆盖我的应用程序。 广告消失了,但它占据的空间现在被一个白色方块挡住了。
我使用XCode 4.5.2,Cordova 2.2和Google AdMob Ads Sdk iOS 6.2.1
我正在使用这个插件https://github.com/ellemayo/phonegap-plugins-1/tree/master/iOS/AdMobPlugin
我也使用这个答案的代码:如何使用Cordova从MainViewController切换admob视图
(void)hideAd:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { CDVPluginResult *pluginResult; NSString *callbackId = [arguments pop]; if (!self.bannerView) { // Try to prevent requestAd from being called without createBannerView first // being called. pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"AdMobPlugin:" @"No ad view exists"]; [self writeJavascript:[pluginResult toErrorCallbackString:callbackId]]; return; } BOOL isHidden = (BOOL)[[options objectForKey:@"isHidden"] boolValue]; self.bannerView.hidden = isHidden; pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [self writeJavascript:[pluginResult toSuccessCallbackString:callbackId]]; }
我用这个javascript调用它:
window.plugins.AdMob.hideAd({ 'isHidden': true }, function(){}, function(){} );链接地址: http://www.djcxy.com/p/64389.html
上一篇: Closing AdMob Ads after opening in Cordova, for iOS
下一篇: Phonegap Plugins