作者inthehope ()
看板MacDev
標題[問題] admob無法顯示,但用官網範例的id就能
時間Wed Oct 7 02:27:52 2015
我用自己註冊的「廣告單元編號」:ca-app-pub-3827344472857629/2471452395
在以下的範例中無法顯示出測試的廣告,執行畫面是一片空白。
但用官方範例提供的就可以跑出測試的廣告劃面,是我漏掉什麼步驟嗎 ?
我是在10/7註冊的廣告單元編號,需要等待幾天才能嗎?
import UIKit
import GoogleMobileAds
class ViewController: UIViewController, GADInterstitialDelegate, UIAlertViewDelegate {
@IBOutlet var bannerView: GADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
//ca-app-pub-3827344472857629/2471452395 myAdUnitId
//ca-app-pub-3940256099942544/2934735716 sample
bannerView.adUnitID = "ca-app-pub-3827344472857629/2471452395"
bannerView.rootViewController = self
self.view.addSubview(bannerView)
bannerView.loadRequest(GADRequest())
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.133.98.229
※ 文章網址: https://www.ptt.cc/bbs/MacDev/M.1444156076.A.0E7.html
※ 編輯: inthehope (220.133.98.229), 10/07/2015 02:29:28
→ cryinglove: 你用@IBOutlet(StoryBoard連結),為何還要addSubviews 10/07 07:23
→ cryinglove: 我看了一下我的Case 用的是DFPBannerView 10/07 07:26
→ cryinglove: 你要不要試試看 10/07 07:27
→ inthehope: 覺得比較怪的地方是用官方的adUnitID會有廣告圖片 10/07 09:30
→ inthehope: 但換成我自己註冊的adUnitID就沒有,但也沒ERROR訊息 10/07 09:31
推 strife00: 我也有同樣的問題,官方的id就有,另外也有用MoPub,也是 03/22 16:44
→ strife00: 一樣 03/22 16:44