The Audience Network allows you to monetize your iOS apps with Facebook ads. This guide explains how to integrate the Audience Network SDK in an iOS app.
Ensure that you have the latest Xcode installed.
Getting Started Steps
Step 1: Download Audience Network SDK
The Audience Network SDK can be downloaded using Cocoapods or manually. Follow these steps to download and include it in your project:
- Add the following line to your project's Podfile:
- Download and extract the Audience Network SDK for iOS.
Step 2: Create and Setup Banner Sample Project
- Open XCode, and choose File -> New -> Project ->Single View Application
Set product name to be
AudienceNetworkTutorial. Enter your organization name and organization identifier.
Note that XCode will create a bundle identifier for your project. In this example, the bundle identifier is
com.yourcompany.AudienceNetworkTutorial. You will use this bundle identifier later when you submit your app for approval as explained in Submit For Review.
Open the folder where you downloaded the Facebook Audience Network SDK and drag
FBAudienceNetwork.frameworkto your app directory in XCode. Select "Copy Items if needed" and click Finish.
Now You have an empty project with
When importing FBAudienceNetwork SDK v4.26, you will get an error saying "No Such Module". To fix this issue, you need to rename FBAudienceNetwork.modulemap to module.modulemap in FBAudienceNetwork.framework/Modules folder. This will be fixed in the next release.
- Explore our code samples which demonstrate how to use native ads. The
NativeAdSampleis available as part of the SDK and can be found under the
FBAudienceNetwork/samplesfolder. Open the project with Xcode and run it either on a device or the simulator.