Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"GoogleMobileAds/GoogleMobileAds.h" file not found error

Tags:

ios

admob

Recently I tried to update admob SDK(iOS) to the latest version(7.0.0)

I have trouble importing the framework. enter image description here

It keeps giving me this error "GoogleMobileAds/GoogleMobileAds.h" file not found

I removed the old admob sdk and imported the framework manually.

enter image description here

I've tried

  • restart xcode
  • cleaning the project (command + shift + k)
  • remove the framework and add it again

No luck, any ideas to solve this? thanks.

like image 946
Keoros Avatar asked Feb 28 '15 03:02

Keoros


2 Answers

After several tries, I've finally managed to build my app (from a Unity project). It took several steps from different answers here, so I'm posting the detailed steps of what I did. (I also want to practice formatting skills here in SO. lol)

Overview: The goal is to install admob cocoapod then set the FrameWork paths. Yes, these have already been mentioned above but they come from different answers which was a bit confusing for me.

Steps:

  1. Close Xcode if you have it running.

  2. Open a Terminal window and enter the following:

    sudo gem install cocoapods
    

    This will install cocoapods

  3. In the same Terminal, cd to your Xcode project directory:

    cd Documents/MyGitHub/MyNiceApp
    
  4. Enter the following:

    pod init
    

    This will create a pod file in the project directory

  5. Open the pod file in a text editor and do the following:

    • Uncomment the line for the platform (update the values if necessary)
    • In the section for Pods, add pod 'Google-Mobile-Ads-SDK', '7.26.0'
    • You can specify a version or leave it out to get the latest, like this: pod 'Google-Mobile-Ads-SDK'
    • The File should look something like this:
        # Uncomment the next line to define a global platform for your project
        platform :ios, '9.0'
        
        target 'MyNiceApp-iPhone' do
          # Comment the next line if you don't want to use dynamic frameworks
          use_frameworks!
        
          # Pods for MyNiceApp-iPhone
          pod 'Google-Mobile-Ads-SDK', '7.26.0'
        
          target 'MyNiceApp-iPhone Tests' do
            inherit! :search_paths
            # Pods for testing
          end
        
        end
  1. Back in the Terminal window where you cd'ed to your Xcode project, enter the following:

    pod install --repo-update
    

    This will install the admob framework and save it in your Xcode project directory

  2. Open Xcode with your project or workspace

  3. In Project Explorer, look for Pods > ... > GoogleMobileAds.framework

    Copy the Full Path from the properties, it would look something like this:

    /Users/mickeymicks/Documents/MyGitHub/MyNiceApp/Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks/GoogleMobileAds.framework
    

    Note: the path contains the "GoogleMobileAds.framework" at the end

  4. Open Build Settings for your TARGETS

    Look for Framework Search Paths, double-click then add a new row for it.

    Paste the path you just copied.

  5. Clean the project then Build.

like image 123
mickeymicks Avatar answered Oct 10 '22 18:10

mickeymicks


I recently had the same error. It was fixed really easy: I needed to open the .xcworkspace file instead of .xcodeproj.

Also did install pods beforehand but not sure if it contributes to the solution :)

like image 28
Pavel Stepanov Avatar answered Oct 10 '22 17:10

Pavel Stepanov