MoPub banner ads with PureLayout (AutoLayout)

ios
ads

#1

Hello,

I’m trying to take advantage of autolayout to layout my banner ads.

Here’s my attempt

        mopubBanner = MPAdView(adUnitId: bannerID, size: bannerSize)
        mopubBanner.delegate = self
    
        // Positions the ad at the bottom, with the correct size
        self.view.addSubview(mopubBanner)
        mopubBanner.translatesAutoresizingMaskIntoConstraints = false
        mopubBanner.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsetsZero, excludingEdge: .Bottom)
    
        // Loads the ad over the network
        mopubBanner.loadAd()

but unfortunately it doesn’t work. When I remove the autolayout code and add a frame, the test ad is shown as expected.