第一步:注册账号 首先你得上KeyMob官网注册账号,由KeyMob移动广告聚合平台提供给你的ID与Key。第二步:下载 KeyMob SDKa.导入swift项目 b.解压KeyMob SDK 文件 c.在storyboard中添加一块view,并设置好布局 d.选择Class第三步:编辑代码import UIKitImport Google Mobile AdsClass viewcontroller:UIViewController{@IBoutlet weak var bannerView:GADBannerView!Override func viewDidLoad(){super.viewDidLoad()bannerView.adUnitId=“ca-app-pub-706657930853688714815911455”bannerView.rootViewController=selfself.view.addSubView(bannerView)Var request:GADRequest=GADRequest()request.testDevices={“”}bannerView.loadRequest(request)}Override func didReceivwMemoryWarning(){super.didReceiveMemoryWarning()}}import UIKitimport GoogleMobileAdsclass ViewController: UIViewController {@IBOutlet weak var bannerView: GADBannerView!override func viewDidLoad() {super.viewDidLoad()// Do any additional setup after loading the view,typically from a nib.bannerView.adUnitID = "你的广告ID" bannerView.rootViewController = self self.view.addSubview(bannerView) var request:GADRequest = GADRequest() equest.testDevices = [""] bannerView.loadRequest(request) }override func didReceiveMemoryWarning() {super.didReceiveMemoryWarning()// Dispose of any resources that can be recreated.}}第四步:测试广告KeyMob移动广告聚合平台:是专门为专业的移动应用广告管理工具,支持国内外多家移动广告聚合平台自由转换(包括:果合、芒果、抓猫、Adview等)。KeyMob在帮助开发者轻松集成多家移动广告聚合平台的同时,应用交叉推广,大幅提升广告填充率,实现广告收入最大化。
原文链接:https://www.f2er.com/swift/325165.html