ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
498 stars 212 forks source link

Banner always shown at the top of the screen on IOS when overlap is set to true #289

Open thibaultzanini opened 5 years ago

thibaultzanini commented 5 years ago

First of all, thank you for your good work! I have been able to migrate my project from the plugin cordova-plugin-admob-pro to yours in less than 30 minutes. However, I think have found an issue on IOS.

If I try to show a banner with the following config:

admob.banner.config({
    id: 'ca-app-pub-xxx/xxx',
    bannerAtTop: false,
    autoShow: false,
    overlap: true
})

The banner is shown at the very top of screen, but it works well on android. So, after investigating a little bit and reading some docs, I think I have found a quick workaround.

I changed the lines of code that you can find here:

https://github.com/ratson/cordova-plugin-admob-free/blob/master/src/ios/CDVAdMob.m#L791-L792

by:

if (bannerOverlap) {
    self.bannerView.frame = bf;
} else {
    self.bannerView.frame = bf;
    self.bannerView.bounds = bf;
}

and it seems to do the trick!

System Info

Ionic:

   ionic (Ionic CLI)  : 4.2.0
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
   Cordova Platforms     : android 6.4.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, 
                           cordova-plugin-ionic-webview 2.2.0, 
                           cordova-admob-sdk 0.20.0, 
                           cordova-plugin-admob-free 0.20.0 (and 14 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/thibaultzanini/Library/Android/sdk)
   ios-deploy        : 1.9.2
   NodeJS            : v8.11.3 (/Users/thibaultzanini/.nvm/versions/node/v8.11.3/bin/node)
   npm               : 5.10.0
   OS                : macOS High Sierra
   Xcode             : Xcode 10.0 Build version 10A255
thibaultzanini commented 5 years ago

I also noticed that non overlapped banner seems to be broken as well.

288

monckey100 commented 5 years ago

I also noticed that non overlapped banner seems to be broken as well.

288

Can confirm. Driving me crazy and preventing me from updating my app on iOS.

Edit: persistent issue, I am using admob pro.

puffnir commented 5 years ago

Hey, Changing the code at https://github.com/ratson/cordova-plugin-admob-free/blob/master/src/ios/CDVAdMob.m#L791-L792 did not help me... I'm not using overlapping.

Any idea? someone?

juanqui66 commented 5 years ago

I have the same problem:

const bannerConfig: AdMobFreeBannerConfig = {        id: this.admobFreeId.banner,        isTesting: true,        autoShow: false,        bannerAtTop: false,        overlap: false      };

With overlap true / false; with autoShow false / true; always leaves the empty hole in the bottom, but the advertising shows it in the top.

"cordova-plugin-admob-free": "^ 0.23.0" "@ ionic-native / admob-free": "^ 4.17.0"

It happens to me since I compiled with XCode 10. Before, it did not happen to me.

The solution:

if (bannerOverlap) {      self.bannerView.frame = bf; } else {      self.bannerView.frame = bf;      self.bannerView.bounds = bf; }

... it did not work for me.

Any ideas? Thanks in advance.

juanqui66 commented 5 years ago

Upgrading to the version: "cordova-plugin-admob-free": "^ 0.25.0" ... the problem is solved.