我想展示一个adMob横幅。我认为我已经正确配置了adMob,但是当我启动该应用程序时,它崩溃并给出著名的错误:线程1:致命错误:在展开一个Optional值时意外发现nil 。我不知道我在做什么错。错误出现在banner1.adUnitID = "ca-app-pub-1314395885924826/98794********"
ViewController.swift行:
import UIKit
import Foundation
import MessageUI
import Firebase
import GoogleMobileAds
class ViewController: UIViewController, MFMailComposeViewControllerDelegate {
@IBOutlet weak var banner1: GADBannerView!
override func viewDidLoad() {
banner1.adUnitID = "ca-app-pub-1314395885924826/98794********" //Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
banner1.rootViewController = self
banner1.load(GADRequest())
// Do any additional setup after loading the view, typically from a nib.
}