Im trying to add the facebook audience network to my project but the tutorial is in objective C and I need it in swift. I already made the bridging header, now I need to add the code. Can someone convert it to swift for me? Thank you! Heres the link if you want to take a look at it:
我试图将Facebook观众网络添加到我的项目,但教程是在客观C,我需要在swift中。我已经制作了桥接头,现在我需要添加代码。有人能为我迅速转换它吗?谢谢!如果你想看一下它的链接:
https://developers.facebook.com/docs/audience-network/ios/banner
- (void)viewDidLoad
{
[super viewDidLoad];
FBAdView *adView = [[FBAdView alloc] initWithPlacementID:PLACEMENT_ID adSize:kFBAdSizeHeight50Banner rootViewController:self];
[adView loadAd];
[self.view addSubview:adView];
}
1 个解决方案
#1
This should work, let me know if any trouble
这应该工作,让我知道是否有任何麻烦
override func viewDidLoad() {
super.viewDidLoad()
let adView: FBAdView = FBAdView(placementID:PLACEMENT_ID, adSize:kFBAdSizeHeight50Banner, rootViewController:self);
adView.loadAd();
self.view.addSubview(adView);
}
#1
This should work, let me know if any trouble
这应该工作,让我知道是否有任何麻烦
override func viewDidLoad() {
super.viewDidLoad()
let adView: FBAdView = FBAdView(placementID:PLACEMENT_ID, adSize:kFBAdSizeHeight50Banner, rootViewController:self);
adView.loadAd();
self.view.addSubview(adView);
}