Closing AdMob Ads after opening in Cordova, for iOS

When I set the bannerView to hidden, there remains a white box overlaying my app. The ad disappears, but the space it occupied is now blocked off by a white box.

I'm using XCode 4.5.2, Cordova 2.2 and Google AdMob Ads Sdk iOS 6.2.1

I'm using this plugin https://github.com/ellemayo/phonegap-plugins-1/tree/master/iOS/AdMobPlugin

I also use code from this answer: How to toggle admob view from MainViewController using Cordova

(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]];
}

I call it with this javascript:

  window.plugins.AdMob.hideAd({
                                            'isHidden': true
                                            },
                                            function(){},
                                            function(){}
                                            );
链接地址: http://www.djcxy.com/p/64390.html

上一篇: 我无法使用CDVPlugin在phonegap 2.7.0中从JavaScript访问本机iOS?

下一篇: 在Cordova中为iOS打开后关闭AdMob Ads