Noor
Noor

Reputation: 2067

Stuck with google admob sdk 7

I have implemented google admob sdk 6.12, ads were appearing , everything was working perfectly, after few days google updated sdk 7, again i imported new sdk but this time i am unable to use #import "GADInterstitial.h" each time i get error #import "GADInterstitial.h" not found, imported all frameworks but no success and no ads are appearing if i use @class GADInterstitial.h; and use this code

- (void)viewDidLoad {
          [super viewDidLoad];
          self.interstitial = [[GADInterstitial alloc] init];
          self.interstitial.adUnitID = Interstical_Unit_id;

          GADRequest *request = [GADRequest request];
          // Requests test ads on simulators.
          request.testDevices = @[ GAD_SIMULATOR_ID ];
          [self.interstitial loadRequest:request];
        }
 - (void)gameOver {
      if ([self.interstitial isReady]) {
        [self.interstitial presentFromRootViewController:self];
      }
      // Rest of game over logic goes here.
    }

Upvotes: 2

Views: 924

Answers (3)

Panayot
Panayot

Reputation: 544

If you add GoogleMobileAdsSdkiOS-7.0.0 folder in your app, you have to replace your #import row with the following:

#import <GoogleMobileAds/GADBannerView.h>

I had the same issue.

Upvotes: 2

user1453351
user1453351

Reputation:

You don't need to import headers anymore, just use this and go

@import GoogleMobileAds

Also you don't need to link other frameworks or add the -ObjC to your linker flags.

Upvotes: 5

guy8214
guy8214

Reputation: 1115

I was having this issue myself after upgrading. Use this instead:

#import <GoogleMobileAds/GADInterstitial.h>

Upvotes: 2

Related Questions