Facebook Twitter Gplus LinkedIn RSS
 
 
Home » Blog » How to Implement iAds into Your App

How to Implement iAds into Your App

Published on June 26th, 2015

As I put the finishing touches on the Swift rewrite of my Lists zApp, I found it a lot harder to put a simple iAd banner on the bottom of my App than it should be. All I really wanted was:

20150626_004520000_iOS

After reading a number of blog and forum posts, I finally found a simple answer, and it makes sense too. Apple doesn’t want displaying iAds to be hard. Yes, you can drag the banner Ads to your storyboard and do fancy manipulation through code, or draw view CGRect all over the screen through code, but all you really need to do is place the following Swift code in any view controller’s “viewDidLoad” function where you want the banner ad displayed.

1
self.canDisplayBannerAds = true
self.canDisplayBannerAds = true

That’s it! Anywhere you want a banner ad at the bottom of your App, put that code in the View Controller. You can send me 0.1% of each ad click as a thank you.

About the Author: Sprawl

Stephen Russell is a Mobile App developer and all around IT geek that spends his days running data centers and his nights coding. This site is the go to place for all of zSprawl’s work and the infamous development blog. In his free time, he enjoys tinkering with web code, playing video games, and otherwise plotting to take over the Internets.


 

Leave a Reply

© 2012 zSprawl's zApps

Fork me on GitHub