2

I am facing a weird problem with iAds banner not showing on Xcode 7.1.1 and iOS 9/9.1. On previous versions it was showing correctly.

Things i have already tried to fix the issue:

1). I tried reinstalling the iAd Framework.

2). I tried creating a new project on a different mac machine.

3). I tried changing the deployment target version from 9.0 to 8.0.

4). I tried all the example projects on Github on iAd.

They all fail to show the apple default advertisement.

Code as below:

import iAd  
class PlayViewController: UIViewController, ADBannerViewDelegate, UITableViewDataSource, UITableViewDelegate {
@IBOutlet var bannerView: ADBannerView?   
override func viewDidLoad() {
    super.viewDidLoad()
    self.canDisplayBannerAds = true
    self.bannerView?.delegate = self
    self.bannerView?.hidden = true
}
func bannerViewDidLoadAd(banner: ADBannerView!) {
    self.bannerView?.hidden = false
    print ("iAd success")
}    
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
    self.bannerView?.hidden = true
}
}
Beraliv
  • 518
  • 7
  • 20
Ankit Khanna
  • 1,019
  • 2
  • 12
  • 22
  • post your code please ! – Nata Mio Nov 22 '15 at 07:15
  • @NataMio: Hi, i have added the code, I did not make any changes in the code as previously it was working just fine. Suddenly, it stopped to show default iAds after the iOS 9.1 & Xcode 7.1.1 update. Delegates are connected properly. To re-confirm that my code is correct i tried to download sample projects for iAds from Github and all of them didn't work now, they use to work before. – Ankit Khanna Nov 23 '15 at 03:52
  • You have two `ADBannerViews` here. One you're creating with `@IBOutlet var bannerView: ADBannerView? ` and the other with `self.canDisplayBannerAds = true`. Remove `self.canDisplayBannerAds = true`. – Daniel Storm Nov 23 '15 at 13:38
  • @DanielStorm: Thanks for the help, But Nata Mio already made this correction while taking the remote of my machine. Still no luck. – Ankit Khanna Nov 24 '15 at 07:10
  • @DanielStorm r u got any solution or information to solve this problem – amit gupta Dec 22 '15 at 07:39
  • @AnkitKhanna r u solve this problem??? – amit gupta Dec 22 '15 at 07:40
  • 1
    @amitgupta: I didn't find a solution to this problem yet, but it seems to be an issue from Apple servers. So you need not worry, you can continue with completion of your project. When the project goes In real iAds testing it should work. – Ankit Khanna Dec 24 '15 at 13:18

1 Answers1

-1

The right steps you should go throw to make iAd shows up:

1-From build phases go to link binary with libraries and add iAd framework.

2-In your class import iAd and place your code without this statement self.canDisplayBannerAds = true because poi have already set the delegate so its not needed.

3-Place banner in storyboard and give it equal hight and width and then add the missing constraints and connect it into your class.

4-Go to Settings - Developer - Fill Rate is 100% so the ad will display.

For more details here check the following sample:

https://drive.google.com/file/d/0B32ROW7V8Fj4R2JrQ2ltakczajA/view?usp=sharing

Update: I've connected with team viewer and discovered that the warning is being printed is ad inventory is not available with code number 3, meaning its an issue from server side.

Nata Mio
  • 2,168
  • 3
  • 22
  • 46
  • Thanks for taking the extra pains in creating a demo project for me. But unfortunately i don't see any banner ads in this project also. I have changed the Fill Rate to 100% but no luck. What i feel this could be because of two issues: 1). either my Xcode is faulty OR unable to connect to Apple Advertisement servers (But previously it was working fine before iOS 9.1 / Xcode 7.1.1) 2). something wrong with the provisioning settings ?? would it be possible to take a remote on team viewer and help me out :) – Ankit Khanna Nov 23 '15 at 09:41