以下是我用于在我的应用中制作广告的代码.我正在使用
Swift在SpriteKit中编程,我正在尝试实施应用程序内购买,以便在支付99美分时禁用iAd.我该怎么做?
以下是制作广告的代码:
class GameViewController: UIViewController, ADBannerViewDelegate {
var bannerView:ADBannerView?
override func viewDidLoad() {
super.viewDidLoad()
//enable banner ads
super.viewDidLoad()
self.canDisplayBannerAds = true
self.bannerView?.delegate = self
self.bannerView?.hidden = true
}
//if banner ad exists, put it on the screen
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.bannerView?.hidden = false
}
//if tapped banner ad, make it full-screen
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return willLeave
}
//if there is no banner ad, take it away
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
self.bannerView?.hidden = true
}
}
我如何实施一个按钮,按下后,向用户收取99¢并删除所有广告?
最佳答案 这有点复杂,我建议你看看Apple
here提供的资源,还有一个很好的教程
Ray(Objective-C).
要创建应用程序内购买,您还必须在Provisioning Portal中配置它们.