How to resize banner ads on Google ads in ios software

I'm trying to use the google ad banner for the full screen of the iPhone for iPad, but unfortunately the iPhone screens show me a warning similar to the following.

Unable to set adSize property. There is not enough space to display an ad with a custom size {600, 50}. Please use the size corresponding to the current screen borders {320, 568}.

0
source share
2 answers

I tried a lot, but the result will be the same, so I'm trying to write code as a google hint. The following code I used to fix this problem.

bannerView.adSize = kGADAdSizeSmartBannerPortrait;

there is no need to set the width constant as 320 on the user interface.

+2
source

I suggest this solution:

  • In Interface Builder, create a Banner View.Center X = Superview.Center X constraint

  • In Interface Builder, create a Banner View.Width = 320 constraint and select Remove during build

  • In the code, set the width like this: adBannerView.adSize = kGADAdSizeSmartBannerPortrait (for portrait)

The debugger will stop complaining about all the iPhone in the portrait

I hope this helps

+1
source

All Articles