I have installed Google Analytics and Google AdMob SDK in my iOS project using Cocoapods. I have implemented both the functionalities in my app and everything looked okay for a week. Then suddenly, when I compiled the app, I received this error message:
"GADBannerView.h file not found". in "#import GADBannerView.h"
But I was able to see the header GADBannerView.h
in my project under Pods target.
I did some research and found this error can happen due to SEARCH PATH
in BUILD SETTINGS
. Many faced similar issues when they moved the project from one machine to another machine but I didn't do that. So, instead of investigating on SEARCH PATH
, I removed my GADBanner
implementation from my project and commented line #import GADBannerView.h
and my project compiled successfully.
I don't quite understand why the Google Analytics SDK is getting compiled successfully while AdMob is throwing a compilation error. I even did a pod update and still received the same error.
The SEARCH PATHS
in my target is $(inherited)
and ALWAYS SEARCH USER PATH
is set to No
Starting at AdMob 7.0, AdMob has made the SDK a framework. Import it like so:
#import <GoogleMobileAds/GoogleMobileAds.h>
Go to: --> Build Settings --> Apple LLVM 7.1 - Language - Modules --> Enable Modules (C and Objective-C) --> set it to Yes.
According to the Google Ads Developer Blog we need to use:
@import GoogleMobileAds;
If you have a problem with the @import
syntax you need to modify your project build settings. Search for Modules and set Enable Modules to YES.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With