gpt4 book ai didi

ios - 在应用内购买时删除 RevMob 广告横幅

转载 作者:行者123 更新时间:2023-11-28 12:30:24 25 4
gpt4 key购买 nike

问题是 Apple 拒绝了我的应用程序,因为当单击按钮购买“无广告”升级时,它不会让横幅消失,直到您关闭应用程序并重新打开它。这是因为我在 viewController.swift 文件中初始化了所有 RevMob 代码。我有一个 bool 值,一旦在这个 viewController.swift 文件中购买了升级,它就会变成 false。因此,下次您打开应用程序并加载 viewController 时, bool 值将设置为 false,并且不允许显示广告。

有人知道这样做是否错误吗?或者有没有一种简单的方法可以让它们在按下无广告按钮后立即消失,而无需关闭应用程序并重新打开它?

//BANNER AD =======================================
let bannerBlock: () -> Void = {
//Custom method defined below
if UserDefaults.standard.object(forKey: "adsBool") as! Bool == true
{
self.showBannerWithCustomFrame()
}
else
{
//don't show ads because user purchased
}
}
let bannerFailBlock: ((Error?) -> Void) = {error in
NSLog("[RevMob Sample App] Session failed to start with error: \(error!.localizedDescription)")
}
RevMobAds.startSession(withAppID: "00000000000000000000",
withSuccessHandler: bannerBlock,
andFailHandler: bannerFailBlock)

这就是我在 GameViewController 中设置 bannerView 的方式

class GameViewController: UIViewController, RevMobAdsDelegate {
var bannerView:RevMobBannerView?

override func viewDidLoad() {
super.viewDidLoad()

最佳答案

来自 RevMob's banner documentation ,有一个名为hideAd 的方法。在 IAP 回调上调用该方法可以解决您的问题,对吧?

To hide the banner: banner!.hideAd()

关于ios - 在应用内购买时删除 RevMob 广告横幅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42196858/

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