I've tried multiple tutorials and tried code in multiple places but can't get google admob to do anything. I get no errors, project builds and runs in simulator. No ads load and no message in debugger. Basically nothing is happening.
I've added the following in my appDelegate
#import <GoogleMobileAds/GoogleMobileAds.h>
#import <GoogleMobileAds/GADBannerView.h>
#import <GoogleMobileAds/GADBannerViewDelegate.h>
#import "Firebase.h"
and under didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
I've put
[FIRApp configure];
[GADMobileAds configureWithApplicationID:@"ca-app-pub-5601547953982889~9365662253"];
in my viewcontroller.h
I've also added
#import <GoogleMobileAds/GoogleMobileAds.h>
#import <GoogleMobileAds/GADBannerView.h>
#import <GoogleMobileAds/GADBannerViewDelegate.h>
#import "Firebase.h"
added
@interface BT_viewController : UIViewController <GADBannerViewDelegate,
and
@property (nonatomic, weak) IBOutlet GADBannerView *bannerView;
and
@protocol GADBannerViewDelegate <NSObject>
@optional
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView;
- (void)adView:(GADBannerView *)bannerView
didFailToReceiveAdWithError:(GADRequestError *)error;
- (void)adViewWillPresentScreen:(GADBannerView *)bannerView;
- (void)adViewDidDismissScreen:(GADBannerView *)bannerView;
- (void)adViewWillDismissScreen:(GADBannerView *)bannerView;
- (void)adViewWillLeaveApplication:(GADBannerView *)bannerView;
@end
then in my view controller.m ive added
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView {
bannerView.hidden = NO;
[BT_debugger showIt:self theMessage:@"Google ad shown"];
}
- (void)adView:(GADBannerView *)bannerView didFailToReceiveAdWithError: (GADRequestError *)error {
NSLog(@"adView:didFailToReceiveAdWithError: %@", error.localizedDescription);
}
and then under -(void)viewDidLoad
I've added
self.bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
self.bannerView.delegate = self;
self.bannerView.adUnitID = @"ca-app-pub-3940256099942544/2934735716";
self.bannerView.rootViewController = self;
[self.view addSubview:self.bannerView];
[self.bannerView loadRequest:[GADRequest request]];
Pretty sure i got it all covered but absolutely nothing is working. No errors, no degub, zip...
Please Help!