I'm having trouble getting AdMob advertising working in my iOS app.
I'm getting a specific error which I will show you below, but first here is what I've tried.

**Here's What I've Tried**

1. Once I got the error in my main app I retrieved the official [BannerExample](https://github.com/googleads/googleads-mobile-ios-examples/releases/tag/6.5) and got it running successfully. BannerView example app runs and I see the ad appear in the app while it's running on my iPhone 5s simulator.
2. I've done all manner of pod update to insure I have the exact new versions of all required packages and keep in mind that the app builds with no problems.
	3. I've debugged it down to a single line of code that I will show you below.

Now that you know I've done quite a bit of work, take a look at what is happening.

**The App Crash**

The exact error is :

> 
> CYaPass[13155:433036] [MC] Reading from private effective user
>  settings. Google Mobile Ads SDK version: afma-sdk-i-v7.15.0 2016-12-04
>  14:37:26.046 CYaPass[13155:432944] -[UIView loadRequest:]:
>  **unrecognized selector sent to instance** 0x7f8bf4546090 2016-12-04
>  14:37:26.055 CYaPass[13155:432944] \*\*\* Terminating app due to uncaught
>  exception
> 
> 
> 

This is not the normal sigabrt on AppDelegate error.
I have tried all the normal things related to StoryBoard and here is an image which shows you I don't have any undefined items that are blowing this up. Plus, I'll show you that when i remove the one line of AdMob code the app will run normally.

[![controller outlets](https://i.stack.imgur.com/YRYuT.png)](https://i.stack.imgur.com/YRYuT.png)

You can see that I do have two outlets defined on the UIView that I'm attempting to use for the BannerView. That's so I could test it when I remove the one line of AdMob code.

You can also see those outlets on the SettingsController

[![outlet settingscontroller](https://i.stack.imgur.com/3aRlb.png)](https://i.stack.imgur.com/3aRlb.png)

You can see them in my actual controller code which looks like the following:

```
    @IBOutlet weak var AdMobs: GADBannerView!

    @IBOutlet weak var SuperView: UIView!
    func loadAd(){
        AdMobs.adUnitID = "ca-app-pub-3940256099942544/2934735716"
        AdMobs.rootViewController = self
        AdMobs.load(GADRequest())
        SuperView.backgroundColor = UIColor.black;
    }

```

I separated those lines into the `loadAd()` func so I could test them from different locations, but it's the same code that the official BannerExample uses and calls in `viewDidLoad()` func.

**Small Test On UIView**

Then, you see I also do a little work on the exact same UIView (SuperView) where I set the backgroundColor to black.

That was to convince myself that it wasn't just becuase I'd attached an outlet to that UIView. But that code works fine, if I simply comment out the three lines before it.

Here, I'll run it and show you the output. Just before I do that, here's my AppDelegate application constructor which doesn't change. It is really a copy of the exact official BannerExample:

```
import Firebase
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate{
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        FIRApp.configure()
        GADMobileAds.configure(withApplicationID: "ca-app-pub-myapp-hiddenforpublicConsumption")
        return true
    }

```

Now, I'll change change loadAd() to look like the following and run again:

```
func loadAd(){
        //AdMobs.adUnitID = "ca-app-pub-3940256099942544/2934735716"
        //AdMobs.rootViewController = self
        //AdMobs.load(GADRequest())
        SuperView.backgroundColor = UIColor.black;
    }

```

Obviously, the only change is that I commented those three lines. Here's what it looks like when it runs.

**Tabbed View Application**

By the way, this is a tabbed app. So the app comes up, I click on the Settings tab and you can see that the altered code in loadAd() runs and turns the background of the UIView black.
[![uiview background black](https://i.stack.imgur.com/9mCO3.png)](https://i.stack.imgur.com/9mCO3.png)

**Main Point : Specific Code Causes Problem**

**Now, let me show you that if I uncomment just that first line of Banner Ad code then the app crashes in the AppDelegate.**

Here's the altered `loadAd()` again:

```
func loadAd(){
        AdMobs.adUnitID = "ca-app-pub-3940256099942544/2934735716"
        //AdMobs.rootViewController = self
        //AdMobs.load(GADRequest())
        SuperView.backgroundColor = UIColor.black;
    }

```

Again, you can see that I've only uncommented the one line that sets the adUnitId on the GADBannerView. This is the exact same code that the BannerExample uses. It even uses the same test unitId which is free for everyone's testing. Also, even if you change that unitId to a invalid value the app does not crash, the ad just doesn't show up.

**Here's The Result**

[![crash](https://i.stack.imgur.com/xWAVx.png)](https://i.stack.imgur.com/xWAVx.png)

**Debugging Shows Exact Line of Code**

I can step into the code and it is exactly on that loadAd() line we just added when this error occurs (shown below for clear reference):

```
 AdMobs.adUnitID = "ca-app-pub-3940256099942544/2934735716"

```

**Only Difference : Tabbed View -- Is That the Issue?**

The only effective difference is that my app is based upon the tabbedview.
Does anyone know why this occurs?

I've been trying everything for almost 2 days now. Any help is appreciated.