gpt4 book ai didi

ios - 并非每次都显示 AdMob 广告

转载 作者:行者123 更新时间:2023-11-28 08:27:09 25 4
gpt4 key购买 nike

<分区>

如何才能通过点击按钮而不是每次都显示 AdMob 广告?是否可以设置在点击多少次之后或广告应该展示多长时间?

import UIKit
import GoogleMobileAds

class ViewController: UIViewController, GADBannerViewDelegate {

@IBOutlet var BannerView: GADBannerView!

var interstitial: GADInterstitial!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

interstitial = GADInterstitial(adUnitID: "ca-app-pub-1469592343938512/3581855984")
let request2 = GADRequest()
interstitial.loadRequest(request2)

let request = GADRequest()
request.testDevices = [kGADSimulatorID]
BannerView.delegate = self
BannerView.adUnitID = "ca-app-pub-1469592343938512/2613153588"
BannerView.rootViewController = self
BannerView.loadRequest(request)

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func createAD() -> GADInterstitial{
let interstitial = GADInterstitial(adUnitID: "ca-app-pub-1469592343938512/3581855984")
interstitial.loadRequest(GADRequest())
return interstitial
}

@IBAction func ShowAD(sender: AnyObject) {
if (interstitial.isReady){

interstitial.presentFromRootViewController(self)
interstitial = createAD()
}
}
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com