dimanche 24 juillet 2016

Implement iAd in Swift app

I want to implement iAd to my Swift app with this code:

bannerView = ADBannerView(adType: .banner)
bannerView.translatesAutoresizingMaskIntoConstraints = false
bannerView.delegate = self
bannerView.isHidden = true
view.addSubview(bannerView)

let viewsDictionary = ["bannerView": bannerView]
view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[bannerView]|", options: [], metrics: nil, views: viewsDictionary))
view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:[bannerView]|", options: [], metrics: nil, views: viewsDictionary))

but in the view.addContraints lines is this error:

Cannot convert value of type '[String : ADBannerView?]' to expected argument type '[String : AnyObject]

I'm not sure what to do.

Aucun commentaire:

Enregistrer un commentaire