AdMob into Xcode
Implement AdMob into Xcode project
Putting AdMob into your Xcode project so your App will show ads from Google is easy!
We recommend that you follow the instructions here.
However, below are some things to double check if it does not work after you followed the instructions.
Add files
When adding all the GAD files to your Xcode project, don't forget to check
"Copy items into destination group's folder".
Add frameworks
When you install these frameworks, note that some may already be installed in your
project and you don't have to do it again. (To install, go here: Build Phases - Link Binary)
StoreKit.framework
AudioToolbox.framework
MessageUI.framework
SystemConfiguration.framework
CoreGraphics.framework
AdSupport.framework
CoreTelephony.framework
Add -ObjC
This is not complicated. You simply type -ObjC to both Debug and Release under "Other Linker Flags"
Edit h and m file
When you have to copy/paste codes to your h and m file, this is really all they ask you to do:
In the h file make sure it has this:
#import "GADBannerView.h"
@interface ViewController : UIViewController {
GADBannerView *bannerView_;
}
and in the m file make sure it has this:
- (void)viewDidLoad {
[super viewDidLoad];
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView_.adUnitID = @"REPLACE-WITH-ADMOB-PUBLISHER-ID";
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
}
Make sure to replace REPLACE-WITH-ADMOB-PUBLISHER-ID with your Publisher-ID.
We recommend that you have a different one for each App you make.
|
|
|
|
|