The Man
The Man

Reputation: 1462

Implementing The AdMob SDK - iPhone

I'm trying to implement the AdMob SDK, but I get these errors and warnings when I run the following code in my viewDidLoad method...

// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"a15030fff8e7e98";

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];

Here are the errors and warnings that I receive... What is wrong?

xCode

Also here are the AdMob files in my Project Navigator...

enter image description here

EDIT: I now receive this crash when my app starts...

'NSInvalidArgumentException', reason: '-[GADBannerView private]: unrecognized selector sent to instance 

Upvotes: 0

Views: 554

Answers (2)

Roman Volkov
Roman Volkov

Reputation: 390

Add the -all_load flag to "Other Linker Flags" and it should work.

Upvotes: 1

Suiz Uzcategui
Suiz Uzcategui

Reputation: 145

First thing I can think of is to go to the Build Phases tab in your Project and check the Link Binary With Libraries box. See if your "libGoogleAdMobAds.a" is there.

Upvotes: 0

Related Questions