Iad Banner Is Not Working

iAd banner not loading when tapped

add this - ADBannerViewDelegate

create variable - var adBanner = ADBannerView()

In viewDidLoad()

        adBanner = iADManager.sharedInstance
adBanner.delegate = self
if DeviceType.IS_IPAD {
adBanner.frame = CGRectMake(0, 20, self.view.frame.width, 65);
}
else {
adBanner.frame = CGRectMake(0, 20, self.view.frame.width, 50);
}

Delegate Methods [if fetched successfully ad then this will add subviews otherwise remove from view]

func bannerViewDidLoadAd(banner: ADBannerView!) {
self.view.addSubview(banner)
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
banner.removeFromSuperview()
}

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return true
}

Below is My shareInstance class. This will more helpful for memory management and loading ads.

class iADManager{

class var sharedInstance: ADBannerView {
struct Static {
static var onceToken: dispatch_once_t = 0
static var instance: ADBannerView? = nil
}
dispatch_once(&Static.onceToken) {
Static.instance = ADBannerView(adType: ADAdType.Banner)
}
return Static.instance!
}
}

iOS - iAd Banners not appearing

Apple are discontinuing the iAd services, an email to that effect was sent out in May"

You are receiving this email because you entered into the Developer Advertising Services Agreement (“Agreement”) to use iAd’s advertising network and related services. We would like to thank you for allowing Apple to serve ads on your mobile properties. As you may know, the iAd App Network and related advertising services will be discontinued on June 30, 2016. More details about the iAd App Network shutdown are here. Note: Any outstanding payments due from Apple will be made no later than September 30, 2016, and campaign reporting data will be available until December 31, 2016.

This email shall serve as written notice that Apple will exercise its option to terminate the Agreement, effective June 30, 2016, 11:59 pm PDT. Nothing contained in, or omitted from, this notice shall be deemed a waiver of any of Apple’s rights, remedies or defenses, all of which are expressly reserved.
"

iAd banner position not updating

Problem Solved!

With the assistance from @aramusss comment I have found that I was calling the function to show the banner in the viewWIllLayoutSubViews function, so I moved it to the viewDidLoad function and it now works!

Thank you all for your help!



Related Topics



Leave a reply



Submit