7

I'm following this tutorial to put Google Ad on my page: https://firebase.google.com/docs/admob/ios/quick-start

At the step:

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

And the error occurred:

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

And after the checking, i see there is no member configureWithApplicationID.

What's wrong with this instruction? And why i have to install Firebase/Core in this version?

Here are methods in GADMobileAds, there is no configureWithApplicationID like Objective C version. How stupid is that https://i.stack.imgur.com/yTCPp.png

0

6 Answers 6

12

Remove the cocoapods line from the instruction and replace with this line:

pod 'Google-Mobile-Ads-SDK'

It will install the google sdk version 7.9.0 and you'll see the configureWithApplicationID method. This is the error from Google for Swift.

2
  • 1
    This is also the case for trying to integrate Firebase using objective-C. Took out the Firebase pods and installed using the SDK pod that @TomSawyer says, and all was good.
    – Animal451
    Jul 22, 2016 at 13:12
  • @Tom I am having same issue as above and i have done all steps what you mention here but still getting same issue. Can you please guide me on this issue ? Jan 25, 2017 at 7:10
4

Xcode 7.3, iOS9.3.3

Followed the instructions above, but wanted to expand, in hopes of saving someone time. If you had 'Google-Mobile-Ads-SDK' pod already installed, then check the version to make sure it is 7.9.0+. Otherwise, you will keep installing the old version over and over.

To update the version, follow the instruction taken from Cocoapods website https://cocoapods.org/pods/Google-Mobile-Ads-SDK click "Installation Guide" (bottom right):

enter image description here

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

What I had that did not work:

enter image description here

What it needs to be:

enter image description here

Again, note the version is 7.9.1

The Podfile looks like this:

# 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 will be able to configure GADMobileAds with the Google prescribed method:

[GADMobileAds configureWithApplicationID:@""];

Or the Swift equivalent:

GADMobileAds.configureWithApplicationID("");

Hope this helps! Cheers.

3
  • I am having same issue as above and i have done all steps what you mention here but still getting same issue. Can you please guide me on this issue ? Jan 25, 2017 at 7:11
  • Thanks for giving it a shot CodeChanger. Could you please link the dependencies and pods you are using? To be completely honest I stopped using cocoapods and reverted back to manual dependency control. It caused more problems and added an extra layer of complexity to the whole process that I did not care for. My rule is if I am using less than 10 dependencies or so, manual dependency control is ok.
    – serge-k
    Jan 27, 2017 at 16:54
  • And please provide the error or elaborate on the issue you are having.
    – serge-k
    Jan 27, 2017 at 16:55
1

Try to update Podfile to the following:

#pod 'Firebase/AdMob' 
pod 'Google-Mobile-Ads-SDK'
1
  • or pod 'Google-Mobile-Ads-SDK', '7.9.1' Jul 27, 2016 at 21:51
0

I recently tried to update my pod to pod 'Google-Mobile-Ads-SDK', '~> 7.9' and it did not work for me. Because I already had a version of Google-Mobile-Ads-SDK in my file, I simply needed to run pod update. The problem was that Google has updated the SDK beyond 7.9 and updating versus naming a specific version ensures you get the latest one.

0

The instructions in the Google documentation are ok. I was running into the same issue with CocoaPods installing the old version. Use the Cocoa Pods update command and it fetches the latest version of Admob and the error goes away.

-1

I see it right here in GADMobileAds.h. Check to see if you have the most up to date 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;
1
  • I'm using swift, and i can't find the configureWithApplicationID method. I use cocoapod exactly like in the instruction
    – TomSawyer
    Jul 15, 2016 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.