1

你好不幸的是我不知道下一步该怎么做。我想安装横幅广告。我遵循了原始的 Google 说明,但它不起作用。我得到错误:

线程 9:“Google 移动广告 SDK 初始化不正确。Google AdMob 发布商,请按照此处的说明进行操作:... 首先安装我的 Pod 并编辑文件: Podfile

(Google Ads 和 Firebase 已连接)

然后代码:

import UIKit
import GoogleMobileAds

class ViewController: UIViewController {

    @IBOutlet weak var bannerview: GADBannerView!
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        
        bannerview.adUnitID = "ca-app-pub-3940256099942544/2934735716"
        bannerview.rootViewController = self
        bannerview.load(GADRequest())
        

然后是 Info.plist 文件:

<key>LSRequiresIPhoneOS</key>
    <true/>
    <key>GADApplicationIdentifier</key>
    <string>ca-app-pub-6251325661183437~1249706529</string>
    <key>SKAdNetworkItems</key> 
      <array>
        <dict>
            <key>SKAdNetworkIdentifier</key>
            <string>cstr6suwn9.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>4fzdc2evr5.skadnetwork</string>
        </dict>
            

她是我的 AppDelegate:

import UIKit
import Firebase




@main
class AppDelegate: UIResponder, UIApplicationDelegate {



    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        
        //Initialize Firebase
        FirebaseApp.configure()
        
        
        
        //Initialize AdMob
        GADMobileAds.configure(withApplicationID: "ca-app-pub-3940256099942544/2934735716")
        
        return true
    }

App-Delegate 发出警告

当我运行我的应用程序时出现此错误: 我的应用程序出错

我希望你有一些提示和帮助我。如果您需要我的代码中的更多信息,请告诉我。感谢您的时间和帮助。

4

0 回答 0