xcode 6 anúncios rápidos GoogleMobileAdsSdkiOS
Estou usando o Xcode 6 + Swift.
Alguém sabe comointegrar o Google Ads, GoogleMobileAdsSdkiOS com umRápido Projeto? como configurar e como programar?
Eu criei um novo arquivoTeste-Bridging-Header.h
no projeto e colocar#import GADBannerView.h
baseado emesta referência
no meuViewController.swift
algo como:
class ViewController: UIViewController {
override func viewDidAppear(animated: Bool) {
super.viewWillAppear(animated)
var adB = GADBannerView()
adB.delegate = self
adB.rootViewController = self
adB.adUnitID = MY_ADS_ID //"ca-app-pub-XXXXXXXX/XXXXXXX"
}
}
Estou indo na direção certa? Posso obter alguns exemplos?
now its working...
on .h created Objective-C bridging header I put:
#import "GADBannerView.h"
#import "GADBannerViewDelegate.h"
#import "GADRequest.h"
my swift file:
class ViewController: UIViewController, GADBannerViewDelegate {
override func viewDidAppear(animated: Bool) {
super.viewWillAppear(animated)
var adB = GADBannerView( frame:CGRectMake(0, 0, 320, 50) )
adB.delegate = self
adB.rootViewController = self
adB.adUnitID = "ca-app-pub-XXXXXXX/XXXXXXXX"
var reqAdB = GADRequest()
//reqAdB.testDevices = [ GAD_SIMULATOR_ID ] //not working, dont know why
//reqAdB.testDevices = ["Simulator"] //not working, dont know why
adB.loadRequest(reqAdB)
self.view.addSubview(adB)
}
}