miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
07/25/15 04:11 AM (8 years ago)

AdMob iOS SDK into Xcode Project

I tried to implement AdMob SDK into my Xcode Project. I followed instructions here: https://developers.google.com/admob/ios/quick-start . I added frameworks, but when I come to: ----------------------------------------------- @import GoogleMobileAds; #import "ViewController.h" @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"Google Mobile Ads SDK version: %@", [GADRequest sdkVersion]); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end The quickest way to add a reference is to open up ViewController.m, import the library, and log the SDK version. ------------------------------------- I don't know what to do. I looked on Youtube videos, but there are all for Swift version. I also found: http://www.buzztouch.com/forum/thread.php?tid=B533B9AE10D8EA7BD41CEC5, but there this item isn't described. Any help?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/25/15 07:40 AM (8 years ago)
In the BT world, a 'viewController' is known as a 'BT_viewController'. These are popularly known as 'plugins'. So, a BT Plugin, is a BT_viewController, which is a subclass of iOS' viewController. So, when you see 'viewController' referenced in these instructions, what you'll want to do is 'pick a screen type plugin', and use it for your tests. The file you want will be the <pluginName>.m file... Open it up in xcode, and put that '@import GoogleMobileAds;' ABOVE your plugins import statements, at the top of the file. The other code will need to be integrated with the existing methods. There is already a viewDidLoad method, so cutting and pasting the entire code will just cause errors. Only copy the code that is 'not already there'. So in this case, copy just the 'NSLog' line, and paste it into the existing 'viewDidLoad' method. You'll probably end up copying the entire 'didReceiveMemoryWarning' because that's usually not in the code by default. Just follow along with what they tell you, but use a plugin. for the most simple test, use the 'blank screen' plugin; there is no other code to confuse you. Just my 2¢... Good Luck! Cheers! -- Smug
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
07/25/15 11:26 AM (8 years ago)
If you search the forums for Admob, you will find this has been done by others and you might even find some instructions on how they did it. I know, because I followed them myself a while back. Cheers, Alan
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
07/25/15 11:29 AM (8 years ago)
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
07/26/15 02:10 AM (8 years ago)
I would like to use AdMob in Spot Finder plugin. When I input @import GoogleMobileAds; in CM_spotFinder.m, I get error: Could not build module "GooglemobileAds". Here is screen, also you can see all my frameworks: https://www.dropbox.com/s/o0mo9rehwv6ya14/screen_admob1.png?dl=0
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
07/26/15 03:53 AM (8 years ago)
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
07/26/15 04:07 AM (8 years ago)
Thanks AlanMac but all of this is very frustrating, I have no idea where to put these pieces of code. Where should I put this: BT_viewController <UIAlertViewDelegate> { GADBannerView *bannerView_; } And this: if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"includeAds" defaultValue:@"1"] isEqualToString:@"1"]){ if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { if([UIScreen mainScreen].bounds.size.height == 568.0) // NSLog(@"Google Mobile Ads SDK version: %@", [GADRequest sdkVersion]); bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height - GAD_SIZE_320x50.height, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height)]; bannerView_.adUnitID = @"ca-app-pub-222222222/2222222"; bannerView_.rootViewController = self; [self.view addSubview:bannerView_]; GADRequest *request = [GADRequest request]; request.testDevices = @[ @"22244434442222222"]; [bannerView_ loadRequest:[GADRequest request]]; } else { [self createAdBannerView]; }
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.