21

Very simple iAd code:

import UIKit
import iAd

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.canDisplayBannerAds = true
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

iAd.framework is loaded.

It used to work. After iOS9, not working. Simulator settings for iAd set to 100% with refresh rate 15secs. Not showing any ads. Tried on actual iPhone 6, 5S, 4S and iPad Air2. Not showing any ads. Am I missing something here? About to lose my mind... All my apps that used to show iAds with no issues are now showing no iAds at all.

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
Mehmet
  • 333
  • 2
  • 10
  • 2
    Same issue here, iAd not displaying ads after iOS9 upgrade. – Joe Rosen Sep 18 '15 at 09:22
  • Were you able to figure it out, Mehmet? – animaonline Oct 16 '15 at 19:29
  • 1
    I accepted the answer from "Daniel Storm". It looks like it was a temporary event and it is now working fine. I also included NSAppTransportSecurity to NSAllowsArbitraryLoads. Although, the app is now available on AppStore, "Square Challenge", iAds show no ads. However, I assume it has nothing do to with the issue of this question and it has to do with the iAd approval process. A little nervous though. – Mehmet Oct 17 '15 at 23:14
  • @Mehmet no, unfortunately it has nothing to do with the approval process, I have exactly the same problem, the ads are displaying on older versions of iOS, but non on iOS 9, according to my logs, didFailToReceiveAdWithError is called, but I don't have the exact error, will let you know when the issue has been fixed. – animaonline Oct 28 '15 at 07:48
  • @Mehmet, i have added `canDisplayBannerAds`. and app transport security. but no luck. :-( – Muruganandham K Feb 02 '16 at 06:38

1 Answers1

11

This is no longer an issue. self.canDisplayBannerAds = true works as expected on devices and simulators running iOS 9 or later.

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
  • Thanks for the (unofficial) confirmation, Daniel. Any info as to what if anything (http vs https?) needs to change in code to get iAd back w/ iOS9? – Joe Rosen Sep 18 '15 at 09:25
  • 1
    I added the following two to the info.plist to no avail: NSAppTransportSecurity and NSAllowsArbitraryLoads – Mehmet Sep 18 '15 at 13:54
  • Why do you think that? Not saying you're wrong, just curious. – Mark Sep 18 '15 at 19:00
  • 1
    @mark Facebook Audience Network ads have also stopped working on iOS9 because of `NSAppTransportSecurity`. Facebook now requires you to [white list their servers for network requests](https://developers.facebook.com/docs/ios/ios9) to fix the issue. I'd imagine the issue with iAd, and the solution, are similar. – Daniel Storm Sep 18 '15 at 19:12
  • So how do we find what apple's iad servers are so we can white list them? Any ideas? – Mark Sep 18 '15 at 19:46
  • Whitelisting ad servers is a terrible idea. Well, but then I'd say advertisements in general are bad idea. If your app has worth, people will buy it. Don't compromise your user's security for lazy advertiser networks. – Léo Natan Oct 07 '15 at 18:53
  • 1
    Hi, Daniel. Is there a solution to this problem? I have enabled Arbitrary traffic, but it did´t help. :( – animaonline Oct 16 '15 at 19:31
  • @DanielStorm, i have used `self.canDisplayBannerAds = true`, but returninng Zero while printing the `self.canDisplayBannerAds`. What is the problem – Muruganandham K Feb 09 '16 at 07:07