swift - bannerViewDidLoadAd is not called -


iad delegate never calls, although set in viewwillappear.

in appdelegate

var uiiad: adbannerview = adbannerview() 

in viewcontroller

var uiiad: adbannerview = adbannerview()   func appdelegate() -> appdelegate {     return uiapplication.sharedapplication().delegate as! appdelegate }  override func viewwillappear(animated: bool) {     var sh = uiscreen.mainscreen().bounds.height      uiiad.delegate = self     uiiad = self.appdelegate().uiiad     uiiad.frame = cgrectmake(0, sh - 50, 0, 0)     self.view.addsubview(uiiad) }  func bannerviewdidloadad(banner: adbannerview!) {     uiview.beginanimations(nil, context: nil)     uiview.setanimationduration(10)     uiiad.alpha = 0.5     println("hello")     uiview.commitanimations() } 

the funny think adbanner show test advertising.

udp: did understand wrong. display iad, need set self.candisplaybannerads = true, thats it. don't have access delegates of banned created.

it appears instantiate uiiad property of app delegate, and uiiad property of viewcontroller. then:

uiiad.delegate = self // viewcontroller's instance gets delegate assigned uiiad = self.appdelegate().uiiad // viewcontroller's instance changes , becomes same app delegate's instance 

this not way i'm used deal iad, in case might suffice changing order of 2 lines of code:

uiiad = self.appdelegate().uiiad uiiad.delegate = self 

hope helps


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -