- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
由于 Apple 在审核过程中没有发现我的广告,我的 iOS 申请被拒绝了。我再次上传了我的申请,包括如何查看广告的说明,今天获得批准。现在,一旦我的 friend 和家人下载了该应用程序,就不会出现任何广告。我检查了我的 AdMob 帐户,但没有显示任何展示次数,所以我不知道出了什么问题。有没有人遇到过这种情况?此外,应用程序获得批准还不到 24 小时。由于 Apple 批准了它,我认为他们已经看到了广告。 My application当您选择一张照片后开始使用过滤器时显示广告。 AdMob 显示 61 次展示、61 次请求和 100% 填充率。
// Initialize Apple iAd banner
func initiAdBanner() {
iAdBannerView = ADBannerView(frame: CGRectMake(0, self.view.frame.size.height, 0, 0) )
iAdBannerView.delegate = self
iAdBannerView.hidden = true
view.addSubview(iAdBannerView)
}
// Initialize Google AdMob banner
func initAdMobBanner() {
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
// iPad banner
adMobBannerView.adSize = GADAdSizeFromCGSize(CGSizeMake(728, 90))
adMobBannerView.frame = CGRectMake(0, self.view.frame.size.height, 728, 90)
} else {
// iPhone banner
adMobBannerView.adSize = GADAdSizeFromCGSize(CGSizeMake(320, 50))
adMobBannerView.frame = CGRectMake(0, self.view.frame.size.height, 320, 50)
}
adMobBannerView.adUnitID = "AdMobPublisherID"
adMobBannerView.rootViewController = self
adMobBannerView.delegate = self
// adMobBannerView.hidden = true
view.addSubview(adMobBannerView)
var request = GADRequest()
adMobBannerView.loadRequest(request)
}
// Hide the banner
func hideBanner(banner: UIView) {
if banner.hidden == false {
UIView.beginAnimations("hideBanner", context: nil)
// Hide the banner moving it below the bottom of the screen
banner.frame = CGRectMake(0, self.view.frame.size.height, banner.frame.size.width, banner.frame.size.height)
UIView.commitAnimations()
banner.hidden = true
}
}
// Show the banner
func showBanner(banner: UIView) {
if banner.hidden == true {
UIView.beginAnimations("showBanner", context: nil)
// Move the banner on the bottom of the screen
banner.frame = CGRectMake(0, (self.view.frame.size.height-70) - banner.frame.size.height,
banner.frame.size.width, banner.frame.size.height);
UIView.commitAnimations()
banner.hidden = false
}
}
// iAd banner available
func bannerViewWillLoadAd(banner: ADBannerView!) {
println("iAd loaded!")
hideBanner(adMobBannerView)
showBanner(iAdBannerView)
}
// NO iAd banner available
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
println("iAd can't looad ads right now, they'll be available later")
hideBanner(iAdBannerView)
var request = GADRequest()
adMobBannerView.loadRequest(request)
}
// AdMob banner available
func adViewDidReceiveAd(view: GADBannerView!) {
println("AdMob loaded!")
hideBanner(iAdBannerView)
showBanner(adMobBannerView)
}
// NO AdMob banner available
func adView(view: GADBannerView!, didFailToReceiveAdWithError error: GADRequestError!) {
println("AdMob Can't load ads right now, they'll be available later \n\(error)")
hideBanner(adMobBannerView)
}
最佳答案
广告现在出现在您的应用程序中。当您的申请获得 Apple 批准后,您还必须获得 iAd 团队的批准才能接收 iAd 广告。这可能还需要几天时间。因此,您的两个广告都没有显示在您的应用程序中。您可以通过转到“设置”>“开发人员”> 并将您的开发设备上的填充率设置为 0% 来对此进行测试。如果 iAd 最初未能加载,则两个广告都不会显示的原因是因为此功能:
// Show the banner
func showBanner(banner: UIView) {
if banner.hidden == true {
UIView.beginAnimations("showBanner", context: nil)
// Move the banner on the bottom of the screen
banner.frame = CGRectMake(0, (self.view.frame.size.height-70) - banner.frame.size.height,
banner.frame.size.width, banner.frame.size.height);
UIView.commitAnimations()
banner.hidden = false
}
}
您正在检查 if banner.hidden == true
但您的 adMobBannerView
的 hidden
值从未设置为 true
直到加载 iAd 横幅。由于在 iAd 团队批准之前没有加载 iAd 横幅,因此从未满足此条件。在不支持 iAd 或 iAd 最初无法加载广告的国家/地区,也永远不会满足此条件。
此外,由于您在屏幕上和屏幕外设置了动画,因此加载广告时会跳跃。一种更优雅的方法是为它们的 alpha
值设置动画,这样用户就不会注意到您的广告何时发生变化。您还可以消除很多代码。我已经重写了您想要完成的内容,并注释掉了其背后的原因。
import UIKit
import iAd
class ViewController: UIViewController, ADBannerViewDelegate, GADBannerViewDelegate {
var iAdBannerView : ADBannerView = ADBannerView()
var adMobBannerView : GADBannerView = GADBannerView()
override func viewDidLoad() {
super.viewDidLoad()
loadAds()
}
func loadAds() {
// iAd
// Changed banners width to match the width of the view it is on
// You need to set the y origin relative to your view. Not a static number.
iAdBannerView = ADBannerView(frame: CGRectMake(0, self.view.frame.size.height - iAdBannerView.frame.height, self.view.frame.size.width, iAdBannerView.frame.height))
iAdBannerView.delegate = self
view.addSubview(iAdBannerView)
// Hide iAd initially
iAdBannerView.alpha = 0.0
// AdMob
// Changed adSize to Googles set banner size
adMobBannerView.adSize = kGADAdSizeBanner
// Changed banners width to match the width of the view it is on
// You need to set the y origin relative to your view. Not a static number.
adMobBannerView.frame = CGRectMake(0, self.view.frame.size.height - adMobBannerView.frame.height , self.view.frame.size.width, adMobBannerView.frame.height)
adMobBannerView.rootViewController = self
adMobBannerView.delegate = self
adMobBannerView.adUnitID = "AdMobPublisherID"
// Dont need var request = GADRequest()
adMobBannerView.loadRequest(GADRequest())
// Do not hide AdMob initially
view.addSubview(adMobBannerView)
}
// Use bannerViewDidLoadAd function so we know ad is fully loaded
func bannerViewDidLoadAd(banner: ADBannerView!) {
println("iAd has an ad to show")
// Animate fade of banners
UIView.beginAnimations(nil, context: nil)
// Show iAd
iAdBannerView.alpha = 1.0
// Hide AdMob
adMobBannerView.alpha = 0.0
UIView.commitAnimations()
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
println("iAd failed to load an ad because \(error)")
// Animate fade of banners
UIView.beginAnimations(nil, context: nil)
// Hide iAd
iAdBannerView.alpha = 0.0
// Show AdMob
adMobBannerView.alpha = 1.0
UIView.commitAnimations()
}
这有利于 iAd,如果 iAd 无法加载广告,则回退到 AdMob。您无需检查 AdMob 何时无法加载广告,因为它的填充率几乎总是 100%,如果没有 AdMob 广告,我怀疑是否有 iAd 广告可以展示。
关于ios - 应用已获批准但未显示 AdMob 广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30386514/
我有以下两个问题,我尝试用谷歌搜索这些问题,但没有找到任何运气。请帮助我。 我已将 AdMob 广告集成到我的 iPhone 应用程序中。当点击admob View 时,safari会被打开,如果加载
我用简单的代码在我的网站上使用了自动点击代码并且它起作用了。下面是我之前使用的代码。 $(document).ready(function(){ var list = document.getEle
我需要将自定义 BLE 广告数据从 ios/android 设备广播到许多自定义 BLE 设备。我的目标是设置 ble adv 包的字节以将其广播到附近的 ble 设备。 据我所知,我需要设置我的 i
我想从动态内容的广告意义上展示广告,即调用 API 并发送一些关键字来获取广告,这可能吗? 例如: Adsense.GetAdsForKeywords("car, subaru, auckland")
一位客户要求我使用他的 Google 发布商 ID 和广告 ID 创建他的广告。 他告诉我在博客上创建这个。 我现在的问题是我不知道他到底是什么意思,因为我习惯的是复制代码并粘贴它。 那么,有人可以向
经过大量搜索,我找不到任何支持以非常小的尺寸(40*40 平方或更少像素)展示广告的广告网络。 我看到应用程序可以这样做(就像左上角的高清摄像头 [附图片])。点击此广告后,它会直接进入 google
我有一个博客,上面有一些赞助帖子。 如果用户访问链接到赞助商的帖子,我希望在其他网站(使用 AdSense)上为最近访问过我网站的访问者显示与该赞助商相关的 AdSense 广告。 这是否可以使用动态
我正在开发一个网站,我想在其中展示 Google 广告。如何在我的网站上测试广告?此外: Google 允许我测试广告吗? 它是否认为我的测试是假印象? 我会被 Adsense 屏蔽吗? 这是网站链接
我在尝试显示来自 Admob 的实时广告时遇到问题。测试广告工作正常,但当我切换到实时广告时,我不断收到此错误 Unable to get provider com.google.android.g
我已经集成了 https://pub.dev/packages/firebase_admob进入我的应用程序并实现 rewarded ads .我现在的问题是我想通过这个插件使用中介。唯一的事情是我知
有关背景信息,请参阅:this question 因此,授权流程的第一步是使用 Web 浏览器中的 URL 获取授权 token ,如下所示。对于桌面应用程序,它需要具有以下签名(我对其进行了未编码以
大约一周前(9 月 13 日)Facebook 推出了新的后置链接格式(看起来更像照片后置 - 大图等)。但是,当我通过 API 上传帖子时(效果很好),尽管 Facebook 界面(直接 Faceb
我有来自 webhook 调用的以下 JSOn 响应 { "responseId": "d5c70d8b-e8ad-41df-bb3b-26b0e51d60ca-a14fa99c", "que
我想在内容前面放置一个 Logo /广告,有很多方法可以做到,但问题是它们使用 JS 显示/隐藏方法。发生的情况是,当用户观看 Logo /广告时,内容不会加载,这会导致用户首先等待 Logo /广告
我一直在按照本教程 ( http://www.kilobolt.com/day-7-creating-an-android-game-from-start-to-finish.html ) 创建 An
我有一个包含 dfp 广告的单页网络应用程序。我有两个我正在触发的 dfp adunits,它们位于内容之间,内容是特定类别的文章列表。 当我点击另一个类别时,它只会加载不同类别的文章(不会更改地址栏
我通过 Facebook 的 Power Editor 上传了 212 封电子邮件的 csv,几秒钟后我可以看到观众中有 200 位用户。 我通过 Facebook 的 Power Editor 将相
我的移动应用程序中有一个 AdMob banndr 广告。大多数时候它不会出现。这是它的工作方式,还是我在设置时做错了什么?泰德 最佳答案 如果没有要显示的广告,则不会返回广告。如果您在 admob
我最近让 admob 广告正常工作,我通过以下方式对其进行了测试: AdRequest adRequest = new AdRequest.Builder()
我正在尝试将 Admob 横幅对齐到设备屏幕的右侧。但是它对我不起作用。我正在创建这样的横幅 RelativeLayout layout = new RelativeLayout(activity
我是一名优秀的程序员,十分优秀!