GoogleのFirebaseに登録し、アプリIDと広告ユニットIDを取得して広告を設置するプログラムを書き、シュミレーターをビルドするとテスト用の広告が表示されません。アプリがクラッシュすることはないですが、デバッグエリアに長々と処理結果が表示されますが何が広告を表示できないのかわからないのでどなたかご回答お願いします。
######処理結果とソースコードを載せておきます。
デバッグ処理結果
2019-04-18 01:13:20.634281+0900 ga[3143:170123] - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2019-04-18 01:13:20.779434+0900 ga[3143:170129] 5.20.0 - <AppMeasurement>[I-ACS025028] AdMob and Firebase are in use in this app, but are not linked. For analytics data consistency and integrity, it is highly recommended that you link your AdMob app to the corresponding Firebase app and re-download the GoogleServices-Info.plist file. See https://support.google.com/admob/answer/6383165 for more information.
2019-04-18 01:13:20.793635+0900 ga[3143:170128] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/imazai/Library/Developer/CoreSimulator/Devices/E118B193-8455-4CAB-AFDD-DF0B87E02007/data/Containers/Shared/SystemGroup
ソースコード
AppDelegate.swift
1import UIKit 2import Firebase 3@UIApplicationMain 4class AppDelegate: UIResponder, UIApplicationDelegate { 5 6 var window: UIWindow? 7 8 9 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 10 // Override point for customization after application launch. 11 // Use Firebase library to configure APIs ★←追記 12 FirebaseApp.configure() // ★←追記 13 14 // Initialize Google Mobile Ads SDK, application IDを設定 ★←追記 15 GADMobileAds.sharedInstance().start() 16 return true 17 } 18
ViewController.swift
1import GoogleMobileAds 2import UIKit 3 4class ViewController: UIViewController { 5 6 override func viewDidLoad() { 7 super.viewDidLoad() 8 } 9 override func didReceiveMemoryWarning() { 10 super.didReceiveMemoryWarning() 11 // Dispose of any resources that can be recreated. 12 } 13 override func viewDidLayoutSubviews(){ // ★←この関数まるまる追記 14 // 広告インスタンス作成 15 var admobView = GADBannerView() 16 admobView = GADBannerView(adSize:kGADAdSizeBanner) 17 18 // 広告位置設定 19 let safeArea = self.view.safeAreaInsets.bottom 20 admobView.frame.origin = CGPoint(x:0, y:self.view.frame.size.height - safeArea - admobView.frame.height) 21 admobView.frame.size = CGSize(width:self.view.frame.width, height:admobView.frame.height) 22 23 // 広告ID設定 24 admobView.adUnitID = "ca-app-pub-3940256099942544/2934735716" 25 26 // 広告表示 27 admobView.rootViewController = self 28 admobView.load(GADRequest()) 29 self.view.addSubview(admobView) 30 }

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/20 14:07
2019/04/20 14:40 編集
2019/05/20 10:28