Я занимаюсь разработкой приложения для Flutter и хочу добавить рекламное объявление при запуске. На Android у меня вообще нет проблем, на ios я получаю следующую ошибку в консоли:
<Google> To get test ads on this device, set: GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ kGADSimulatorID ];
<Google> Invalid application ID. Follow instructions at https://developers.google.com/admob/ios/quick-start#initialize_mobile_ads to find your app ID in the AdMob UI.
Syncing files to device iPhone 11 Pro Max...
), error=(null) on <SOConfigurationClient: 0x600002a734c0>
flutter: InterstitialAd MobileAdEvent.loaded
[C2.1 0EC72EE0-6FAB-4A1B-85DF-1CB19917031B 192.168.0.13:56426<->77.192.211.175:443/5228]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.082s, DNS @0.002s took 0.006s, TCP @0.010s took 0.011s, TLS took 0.042s
bytes in/out: 3897/1515, packets in/out: 4/3, rtt: 0.010s, retransmitted packets: 0, out-of-order packets: 0
path: satisfied (Path is satisfied), interface: en0
[C3.1 0EC72EE0-6FAB-4A1B-85DF-1CB19917031B 192.168.0.13:56427<->77.192.211.175:443/5228]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.196s, DNS @0.000s took 0.003s, TCP @0.005s took 0.014s, TLS took 0.031s
bytes in/out: 1935140/1521, packets in/out: 1349/3, rtt: 0.014s, retransmitted packets: 0, out-of-order packets: 0
[C4.1 0EC72EE0-6FAB-4A1B-85DF-1CB19917031B 192.168.0.13:56429<->77.192.211.175:443/5228]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.161s, DNS @0.001s took 0.002s, TCP @0.003s took 0.011s, TLS took 0.040s
bytes in/out: 879686/1527, packets in/out: 614/3, rtt: 0.011s, retransmitted packets: 0, out-of-order packets: 0
Syncing files to device iPhone 11 Pro Max... 11,248ms (!)
Я связал приложение с Firebase и AdMob, и фактически я поместил идентификатор приложения (находится в AdMob) в файле Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-6112659362985719~7627685066</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
...
...
...
Кроме того, здесь вы можете найти код AppDelegate.swift:
import UIKit
import Flutter
import Firebase
import GoogleMobileAds
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
var interstitial: GADInterstitial!
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
GADMobileAds.sharedInstance().start(completionHandler: nil)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
, как указано в Google quick начало руководство . Я поместил в проект GoogleService-Info.plist, загруженный Firebase.
Я добавил следующие зависимости в PodFile:
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Analytics'
pod 'Google-Mobile-Ads-SDK'
Наконец, я добавил каркасы Google как указано в кратком руководстве здесь
Я думаю, что все сделал, но все равно у меня есть выделенная ошибка. Я что-то упустил?