我试图提供Facebook原生广告模板,没有运气。
class ViewController: UIViewController, FBNativeAdDelegate
{
override func viewDidLoad()
{
super.viewDidLoad()
facebookAdViewContainer.backgroundColor = UIColor.greenColor()
let nativeAd = FBNativeAd(placementID: <id>)
nativeAd.delegate = self
nativeAd.loadAd()
...
}
func nativeAdDidLoad(nativeAd: FBNativeAd)
{
let attributes = FBNativeAdViewAttributes()
attributes.backgroundColor = UIColor.blueColor()
let adview = FBNativeAdView(nativeAd: nativeAd, withType:FBNativeAdViewType.GenericHeight300)//, withAttributes: attributes)
adview.hidden = false
self.topBannerViewContainer.addSubview(adview)
}
...
}
正如您在图片中看到的那样,广告未展示。至少我希望看到广告的蓝色背景,但我能看到的只是容器的绿色背景