Integrating the Google Mobile Ads SDK into an app is the first step toward displaying ads and earning revenue. Once you've integrated the SDK, you can proceed to implement one or more of the supported ad formats.
- Use Xcode 11 or higher
- Target iOS 9.0 or higher
Import the Mobile Ads SDK
The simplest way to import the SDK into an iOS project is to use 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.
Download and unzip the SDK framework directly, and import the following frameworks into your Xcode project:
-ObjClinker flag to Other Linker Flags in your project's build settings:
Update your Info.plist
Update your app's
Info.plist file to add two keys:
GADApplicationIdentifierkey with a string value of your Ad Manager app ID (identified in the Ad Manager UI).
SKAdNetworkItemskey with Google's
<key>GADApplicationIdentifier</key> <string>ca-app-pub-3940256099942544~1458002511</string> <key>SKAdNetworkItems</key> <array> <dict> <key>SKAdNetworkIdentifier</key> <string>cstr6suwn9.skadnetwork</string> </dict> </array>
Or, edit it in the property list editor:
For optimal initialization performance, it is important to associate your yield groups with the specific apps they are used in. Yield group configurations targeting iOS and not associated with any specific app will be sent to all iOS apps in your account, potentially lengthening the time required to initialize.
Select an ad format
The Mobile Ads SDK is now imported and initialized, and you're ready to implement an ad. Ad Manager offers a number of different ad formats, so you can choose the one that best fits your app's user experience.
Rectangular ads that appear at the top or bottom of the device screen. Banner ads 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.
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 between levels of a game or just after a task is completed.
Customizable ads that match the look and feel of your app. You decide how and where they're placed, so the layout is more consistent with your app's design.
Google Ad Manager offers two ways to implement native ads: Native Styles and Custom Rendering.
Native Styles has been designed to make the implementation of 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 freedom you have in creating your presentations.
|Implement Native Styles||Implement Custom Rendering|
Ads that reward users for watching short videos and interacting with playable ads and surveys. Good for monetizing free-to-play users.
|Implement Rewarded Ads||Implement Rewarded Ads (new APIs)|