Ads now appear in your application. When your application is approved by Apple, it must still be approved by the iAd team in order to receive iAd advertising. This may take several days. As a result, none of your advertisements were shown in your application. You can verify this by going to Settings> Developer and setting your fill rate to 0% on your development device. The reason that no ads are displayed if the iAd is not initially loaded due to this function:
// Show the banner func showBanner(banner: UIView) { if banner.hidden == true { UIView.beginAnimations("showBanner", context: nil) // Move the banner on the bottom of the screen banner.frame = CGRectMake(0, (self.view.frame.size.height-70) - banner.frame.size.height, banner.frame.size.width, banner.frame.size.height); UIView.commitAnimations() banner.hidden = false } }
You check if banner.hidden == true , but adMobBannerView hidden never set to true until the iAd banner is loaded. Seeing that not a single iAd banner was loaded before being approved by the iAd team, this condition was never met. This condition will also never be met in countries that do not support iAd, or if iAd does not load the ad natively.
In addition, there are many jumps when your ads load due to the fact that you simulate them on the screen and out of it. A more elegant approach would be to animate their alpha values โโso that the user doesn't notice when your ads change. You can also completely exclude your code. I rewrote what you are trying to accomplish, and commented on the reasons for this.
import UIKit import iAd class ViewController: UIViewController, ADBannerViewDelegate, GADBannerViewDelegate { var iAdBannerView : ADBannerView = ADBannerView() var adMobBannerView : GADBannerView = GADBannerView() override func viewDidLoad() { super.viewDidLoad() loadAds() } func loadAds() {
This promotes the iAd and returns to AdMob if the iAd does not load the ad. You donโt need to check when AdMob doesnโt load the ad, because its fill factor is almost always 100%, and if there is no AdMob ad, I doubt that the iAd ad will appear there.
source share