Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import GoogleMobileAds framework?

Tags:

ios

admob

I am following the instructions on the following page to integrate admob with my iOS application:

https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start#manually_using_the_sdk_download

Unfortunately, when I try:

@import GoogleMobileAds;

my project won't compile, with the error:

Use of '@import' when modules are disabled

I tried the following:

  1. Using #import instead of @import. This does not work, because "GoogleMobileAds" does not show up. Instead I have to import the framework, which leads to many errors showing up, which xcode doesn't even display because there are too many.

  2. Going to my target -> build settings -> Apple LLVM 6.0 - Language - Modules -> Enable Modules (C and Objective-C) and setting it to "YES". Even after doing this the same error appears.

How does one fix this ?

like image 263
Rahul Iyer Avatar asked Sep 05 '26 15:09

Rahul Iyer


1 Answers

It seems that one needs to use #import , and specify each specific file as necessary. For example:

#import <GoogleMobileAds/GoogleMobileAds.h>

I guess the instructions on the Google site are out of date.

like image 129
Rahul Iyer Avatar answered Sep 08 '26 06:09

Rahul Iyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!