IOS: Incorrect Google Mobile Ads SDK Installation Instructions?

I follow this guide to host Google Ad on my page: https://firebase.google.com/docs/admob/ios/quick-start

On the step:

GADMobileAds.configureWithApplicationID("ca-app-pub-8123415297019784~8909888406");

And an error occurred:

 AppDelegate.swift:58:9: Type 'GADMobileAds' has no member 'configureWithApplicationID' 

And after checking, I see that there is no configureWithApplicationID member.

What happened to this instruction? And why should I install Firebase / Core in this version?

Here are the methods in GADMobileAds, there is no configureWithApplicationID like Objective C. How stupid is that http://i.imgur.com/Od0vkPg.png

+6
source share
6 answers

Extract the cocoapods line from the statement and replace it with the following line:

 pod 'Google-Mobile-Ads-SDK' 

It will install the google sdk version 7.9.0 and you will see the configureWithApplicationID method. This is a Google bug for Swift.

+10
source

Xcode 7.3, iOS9.3.3

Following the instructions above, but wanted to expand, hoping to save time. If you already have the Google-Mobile-Ads-SDK installed, check the version to make sure it is 7.9.0 + . Otherwise, you will continue to install the old version again and again.

To upgrade, follow the instructions on the Cocoapods website https://cocoapods.org/pods/Google-Mobile-Ads-SDK click on the “Installation Guide” (bottom right):

enter image description here

The bit '~> 7.9' will force the update.

What I did not succeed:

enter image description here

What it should be:

enter image description here

Note again that version 7.9.1

The subfile is as follows:

 # Uncomment this line to define a global platform for your project # platform :ios, '9.0' target 'AppName' do # Uncomment this line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for AppName pod 'Firebase' pod 'Google-Mobile-Ads-SDK', '~> 7.9' target 'AppNameTests' do inherit! :search_paths # Pods for testing end end 

Now you can configure GADMobileAds using the method prescribed by Google:

 [GADMobileAds configureWithApplicationID:@""]; 

Or the Swift equivalent:

 GADMobileAds.configureWithApplicationID(""); 

Hope this helps! Greetings.

+4
source

Try updating the subfile as follows:

 #pod 'Firebase/AdMob' pod 'Google-Mobile-Ads-SDK' 
+1
source

I recently tried updating my module to the pod 'Google-Mobile-Ads-SDK', '~> 7.9' , and this did not work for me. Since I already had the Google-Mobile-Ads-SDK version in my file, I just needed to run pod update . The problem was that Google updated the SDK above 7.9, and the upgrade compared to naming a specific version ensures that you get the latest version.

0
source

The instructions in the Google documentation are fine. I ran into the same problem when CocoaPods installed the old version. Use the Cocoa Pods update command and select the latest version of Admob and the error will disappear.

0
source

I see it here in GADMobileAds.h . Check if you have the most current version.

 // // GADMobileAds.h // Google Mobile Ads SDK // // Copyright 2015 Google Inc. All rights reserved. // #import <Foundation/Foundation.h> @interface GADMobileAds : NSObject /// Returns the shared GADMobileAds instance. + (GADMobileAds *)sharedInstance; /// Configures the SDK using the settings associated with the given application ID. + (void)configureWithApplicationID:(NSString *)applicationID; 
-one
source

All Articles