ios - iAd Interstitials not showing consistently? And not at all on the simulator -


iad interstitials aren't showing @ on iphone simulator, , don't show consistently on iphone. i've gone developer settings, changed fill rate 100%, , turned on unlimited ad presentation. no difference... interstitial show first time it's supposed to, , won't show again anywhere few minutes fifteen minutes. no idea causing difference in time.

also, there doesn't seem way track if interstitial going show or not / if showed or didn't. realize there's interstitial delegate, seems isn't used anymore. way calling interstitial using viewcontroller.interstitialpresentationpolicy = adinterstitialpresentationpolicy.automatic

thanks!

so seems using requestinterstitialadpresentation intended used when adinterstitialpresentationpolicy set automatic. when implementing interstitials using manual adinterstitialpresentationpolicy must use presentinview present ad @ own intervals. when presenting interstitial in manner not load own close button dismiss itself. so, i've done created uiview present interstitial in , used interstitials delegate methods dismiss uiview. inconsistency receiving ad iad network still arises when testing. receive ad, fails load allows request new ad, , nothing happens @ all. seems nature of iad's interstitials.

import uikit import iad // import iad  class viewcontroller: uiviewcontroller, adinterstitialaddelegate { // include delegate      var iadinterstitial = adinterstitialad() // our ad     var iadinterstitialview = uiview() // view present our ad in     var adloaded = false // bool keep track if ad loaded or not      override func viewdidload() {         super.viewdidload()         setupad()     }      func setupad() {         // set presentation manual can choose when present interstitial         // setting fetch interstitial ad         self.interstitialpresentationpolicy = adinterstitialpresentationpolicy.manual         iadinterstitial.delegate = self // set delegate          // make our view same size view presenting in         iadinterstitialview.frame = self.view.bounds     }      func requestnewad() {         // fetch ad         viewcontroller.prepareinterstitialads()         println("requesting new ad")     }      @ibaction func presentadbutton(sender: anyobject) {         if (adloaded) {             // have ad loaded lets present             self.view.addsubview(iadinterstitialview)             iadinterstitial.presentinview(iadinterstitialview)         }         else {             // no ad has been loaded             println("ad not loaded")         }     }      func interstitialaddidunload(interstitialad: adinterstitialad!) {         // kinda works expected         // called prematurely         // takes minutes after ad dismissed called         println("interstitialaddidunload")          // new ad         adloaded = false         iadinterstitialview.removefromsuperview()         requestnewad()     }      func interstitialad(interstitialad: adinterstitialad!, didfailwitherror error: nserror!) {         // failed load ad lets try again         println("didfailwitherror: \(error)")         requestnewad()     }      func interstitialadwillload(interstitialad: adinterstitialad!) {         // there ad , has begun download         println("interstitialadwillload")     }      func interstitialaddidload(interstitialad: adinterstitialad!) {         // got ad         println("interstitialaddidload")         adloaded = true     }      func interstitialadactionshouldbegin(interstitialad: adinterstitialad!, willleaveapplication willleave: bool) -> bool {         println("interstitialadactionshouldbegin")         return true;     }      func interstitialadactiondidfinish(interstitialad: adinterstitialad!) {         // done ad. lets new 1         println("interstitialadactiondidfinish")         iadinterstitialview.removefromsuperview()         adloaded = false         requestnewad()     } 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -