以下のサイトを見て広告を表示しようとしています。Test用の広告を表示することはできましたが、実機をテストデバイスとして登録するという部分で、登録して表示をさせようとした時にうまくいきません。
https://i-app-tec.com/ios/admob.html
TestIDを用いて以下の様にloadを行うとテスト広告の上にtestと表示されるのでデバイス登録自体はできている様に思います。しかしこれをAdmobで表示された広告ユニットIDにすると表示されません。
Swift
1let request = GADRequest() 2request.testDevices = [ "Test Device ID" ] 3admobView.load(request)
Admobで確認すると作成した広告は以下の様になっています。
有効なアイテム0個となっていますが、そもそもこれらの広告は有効になっていないのでしょうか?
新しくadmobのためだけにプロジェクトを作って実行したところやはり表示できませんでしたが、以下にそのさいのコードとログを示します。
SWift
1import UIKit 2import GoogleMobileAds 3 4class ViewController: UIViewController { 5 6 // 広告ユニットID 7 let AdMobID = "広告ユニットID" 8 // テスト用広告ユニットID 9 let TEST_ID = "ca-app-pub-3940256099942544/2934735716" 10 11 // true:テスト 12 let AdMobTest:Bool = false 13 14 override func viewDidLoad() { 15 super.viewDidLoad() 16 17 print("Google Mobile Ads SDK version: (GADRequest.sdkVersion())") 18 19 var admobView = GADBannerView() 20 21 admobView = GADBannerView(adSize:kGADAdSizeBanner) 22 23 admobView.frame.origin = CGPoint(x:0, y:self.view.frame.size.height - admobView.frame.height - 34) 24 admobView.frame.size = CGSize(width:self.view.frame.width, height:admobView.frame.height) 25 26 if AdMobTest { 27 admobView.adUnitID = TEST_ID 28 } 29 else{ 30 admobView.adUnitID = AdMobID 31 } 32 33 admobView.rootViewController = self 34 //admobView.load(GADRequest()) 35 36 37 let request = GADRequest() 38 request.testDevices = [ "デバイスID" ] 39 admobView.load(request) 40 41 self.view.addSubview(admobView) 42 } 43 44 45}
以下Appdelegate
Swift
1 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 2 // Override point for customization after application launch. 3 FirebaseApp.configure() 4 GADMobileAds.configure(withApplicationID: "ca-app-pub-xxxxxx") 5 return true 6 } 7
YMTLInitPlatform] platform initialization successful
2019-02-18 13:37:54.491123+0900 testAdmob[22214:5406194] - <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-02-18 13:37:54.596618+0900 testAdmob[22214:5406211] 5.16.0 - [Firebase/Analytics][I-ACS023007] Analytics v.50500000 started
2019-02-18 13:37:54.596960+0900 testAdmob[22214:5406211] 5.16.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2019-02-18 13:37:54.639346+0900 testAdmob[22214:5406208] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2019-02-18 13:37:54.640114+0900 testAdmob[22214:5406208] [MC] Reading from public effective user settings.
Google Mobile Ads SDK version: afma-sdk-i-v7.39.0
2019-02-18 13:37:54.658186+0900 testAdmob[22214:5406187] 5.16.0 - [Firebase/Analytics][I-ACS025026] Deferring to Firebase for event data collection
2019-02-18 13:37:54.680709+0900 testAdmob[22214:5406214] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x281517260, domain=1, instance=1>
2019-02-18 13:37:54.714604+0900 testAdmob[22214:5406038] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port スピーカー (type: Speaker)
2019-02-18 13:37:54.982855+0900 testAdmob[22214:5406187] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x10500f2c0] get output frames failed, state 8196
2019-02-18 13:37:54.982983+0900 testAdmob[22214:5406187] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x10500f2c0] get output frames failed, state 8196
2019-02-18 13:37:54.983250+0900 testAdmob[22214:5406187] TIC Read Status [1:0x0]: 1:57
2019-02-18 13:37:54.983280+0900 testAdmob[22214:5406187] TIC Read Status [1:0x0]: 1:57
2019-02-18 13:37:55.298193+0900 testAdmob[22214:5406229] WF: === Starting WebFilter logging for process testAdmob
2019-02-18 13:37:55.298347+0900 testAdmob[22214:5406229] WF: _userSettingsForUser mobile: {
filterBlacklist = (
);
filterWhitelist = (
);
noOverridingAllowed = 1;
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
2019-02-18 13:37:55.298500+0900 testAdmob[22214:5406229] WF: _WebFilterIsActive returning: NO
2019-02-18 13:37:55.765835+0900 testAdmob[22214:5406038] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port スピーカー (type: Speaker)
2019-02-18 13:39:56.611369+0900 testAdmob[22214:5406577] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C4.1:2][0x105028860] get output frames failed, state 8196
2019-02-18 13:39:56.611863+0900 testAdmob[22214:5406577] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C4.1:2][0x105028860] get output frames failed, state 8196
2019-02-18 13:39:56.612878+0900 testAdmob[22214:5406577] TIC Read Status [4:0x0]: 1:57
2019-02-18 13:39:56.612977+0900 testAdmob[22214:5406577] TIC Read Status [4:0x0]: 1:57

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/02/23 02:52
2019/02/24 09:07 編集
2019/02/26 07:55