【发布时间】:2016-09-03 19:30:30
【问题描述】:
我已经从应用代理实现了插页式广告,并且加载正常。现在我想将购买按钮删除,我很困惑。
这是我的代码:
class AppDelegate: UIResponder, UIApplicationDelegate, GADInterstitialDelegate {
var window: UIWindow?
var myInterstitial: GADInterstitial!
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
myInterstitial = createAndLoadInterstitial()
return true
}
func createAndLoadInterstitial()->GADInterstitial {
let interstitial = GADInterstitial(adUnitID: "xxxxx")
interstitial.delegate = self
interstitial.loadRequest(GADRequest())
return interstitial
}
func interstitialDidReceiveAd(ad: GADInterstitial!) {
print("interstitialDidReceiveAd")
}
func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) {
print(error.localizedDescription)
}
func interstitialDidDismissScreen(ad: GADInterstitial!) {
print("interstitialDidDismissScreen")
myInterstitial = createAndLoadInterstitial()
}
和视图控制器:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
override func viewWillAppear(animated: Bool) {
appDelegate.myInterstitial?.presentFromRootViewController(self)
}
【问题讨论】:
-
你对什么感到困惑?这里真正的问题是什么?
-
购买时如何去除广告?
标签: ios swift2 in-app-purchase admob interstitial