Reputation: 1387
Recently I tried to update admob SDK(iOS) to the latest version(7.0.0)
I have trouble importing the framework.
It keeps giving me this error "GoogleMobileAds/GoogleMobileAds.h" file not found
I removed the old admob sdk and imported the framework manually.
I've tried
No luck, any ideas to solve this? thanks.
Upvotes: 10
Views: 34068
Reputation: 1227
Check that you have google_mobile_ads.framework
in the Frameworks section in the General tab of your project target settings.
If not add the framework with the '+' button. It works for my case
Upvotes: 0
Reputation: 957
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 :)
Upvotes: 1
Reputation: 669
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:
Close Xcode if you have it running.
Open a Terminal window and enter the following:
sudo gem install cocoapods
This will install cocoapods
In the same Terminal, cd to your Xcode project directory:
cd Documents/MyGitHub/MyNiceApp
Enter the following:
pod init
This will create a pod file in the project directory
Open the pod file in a text editor and do the following:
pod 'Google-Mobile-Ads-SDK', '7.26.0'
pod 'Google-Mobile-Ads-SDK'
# 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
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
Open Xcode with your project or workspace
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
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.
Clean the project then Build.
Upvotes: 1
Reputation: 61
After a days of web scraping i found a solution..You can follow the guide on the google ad mob official page.I have added the link... https://developers.google.com/admob/ios/quick-start#cocoapods
Upvotes: 1
Reputation: 23
This worked for me: #import <GoogleMobileAds/GADInterstitialDelegate.h>
Upvotes: -1
Reputation: 956
This is the Solution
#1 Open Terminal install Cocoapods -> $ sudo gem install cocoapods
#2 Open Terminal and Enter Path of Your Directory -> cd desktop/gamebuild
#3 Enter this on Terminal -> Pod Init
#4 Go To Directory Paste This Line in Podfile -> pod 'Google-Mobile-Ads-SDK'
#5 Close File and Enter this on Terminal-> Pod install
Upvotes: 1
Reputation: 33
I am manually dragging the AdMob SDK into my project and was getting this error. Ultimately what worked was I dragged the SDK files into my projects folder on the computer (for me it was: Users/aaronfrom/documents/projectname) when asked to replace files I said yes. It then worked. I think that this is where my framework search path was directed towares and I needed to update the files in the project folder on my computer, it had nothing to do with settings in Xcode.
Upvotes: 0
Reputation: 79
I have tried to put the GoogleMobileAds.framework\Versions\A\Headers
folder to GoogleMobileAds.framework
folder and it worked for me.
Note:
You must delete Header
file first. It's already here in GoogleMobileAds.framework
folder.
And useGoogleMobileAds.framework\Versions\A\GoogleMobileAds
replace GoogleMobileAds.framework\GoogleMobileAds
Upvotes: 0
Reputation: 22042
In Xcode Settings, change below settings
Enable Modules (C and Objective-C) YES
Upvotes: 2
Reputation: 1094
Answer is to change the 'Framework Search Paths' build setting to the folder where your 'GoogleMobileAds.framework' is located.
Full steps I did to solve:
Remove references to the framework from project navigator
Click on your project in the project navigator, then on your project under 'TARGETS', then click 'Build Phases'
Expand 'Link Binary With Libraries'
Select 'GoogleMobileAds.framework' and click the '-' (if it's there)
Click the '+'
Click 'Add Other...', find and select 'GoogleMobileAds.framework' and click 'Open'
The google ads framework should now be in the list
Click 'Build Settings'
Change 'Framework Search Paths' to the folder where your 'GoogleMobileAds.framework' is located
Clean and re-build project
Upvotes: 11
Reputation: 302
Looks like they have some specific dependences and must be added to folder where is located .xcodeproj
this is actual for modul import and without pods: @import GoogleMobileAds;
Upvotes: 0
Reputation: 1452
Right click on framework --> show in finder --> Delete framework from that place.--> go to the project and see at your framework place , its in red color .
Again right click on that and delete it. Again run project and save project . i know the build not successful.
Again add the framework and then run before that clean your project.
Upvotes: 2
Reputation: 309
don't drag framework in your project.. just only copy past in your project folder and add files TO in your project..
i think it's 100% working.
Upvotes: 1