Integrating the Google Mobile Ads SDK into an app is the first step toward displaying ads and earning revenue. Once that's done, you can proceed to implement one or more of the supported ad formats.
- Use Xcode 8.0 or higher
- Target iOS 6.0 or higher
Import the Mobile Ads SDK
The simplest way to import the SDK into an iOS project is with CocoaPods. Open your project's Podfile and add this line to your app's target:
Then from the command line run:
pod install --repo-update
If you're new to CocoaPods, see their official documentation for info on how to create and use Podfiles.
You can also download a copy of the SDK framework directly, unzip the file, and import the framework into your project in Xcode.
Select an ad format
The Mobile Ads SDK is now imported and initialized, and you're ready to implement an ad. DFP offers a number of different ad formats, so you can choose the one that best fits your app's user experience.
Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time. If you're new to mobile advertising, they're a great place to start.
Interstitials are full-screen ads that cover the interface of an app until closed by the user. They're best used at natural pauses in the flow of an app's execution, such as in between levels of a game or just after completing a task.
Native is a component-based ad format that gives you the freedom to customize the way assets like headlines and calls to action are presented in their apps. By choosing fonts, colors, and other details for yourself, you can create natural, unobtrusive ad presentations that can add to a rich user experience.
DFP offers two different ways to implement native ads: Native Styles and Custom Rendering. Native Styles has been designed to make getting on board with native ads as easy as possible, and it's a great choice if you are new to the format. Custom Rendering has been designed to maximize the amount of freedom you have in creating your presentations.