Add the Audience Network SDK to your iOS App

Act now on iOS 14.5 changes

All publishers must use Audience Network SDK 6.2.1 or later in order to monetize with iOS 14.5 users. (We also recommend Audience Network SDK 6.2.1 for iOS 14 users.) Within this version there are two requirements:

  • Implement the setAdvertiserTrackingEnabled flag, irrespective of the use of mediation, to inform us whether to use the data to deliver personalized ads.
  • Add the suggested SKAdNetwork IDs to the Xcode project’s Info.plist in order for advertisers to measure the success of ad campaigns.

Read more on our Meta for Developers post

Upgrade to the latest version of the SDK before onboarding your app for monetization.

This guide explains how to include the Audience Network SDK in your iOS app so that you can call Audience Network APIs. The preferred method is to use CocoaPods to manage the dependencies; however, download locations for manual integration are also provided.

CocoaPods (Preferred Download Method)

Add the following line to your project's Podfile.

pod 'FBAudienceNetwork'

Run the following command.

pod install

Manual Download

If using CocoaPods is not an option, you can download the Audience Network SDK from one of the locations in the following table.

After you download the Audience Network SDK, complete the integration as follows:

  1. Open your project in XCode.
  2. Drag & drop FBAudienceNetwork.xcframework from the Dynamic folder in your downloaded iOS Audience Network SDK archive into XCode.
  3. In the General tab in your application target settings select Embed & Sign for FBAudienceNetwork.xcframework

Notes

  • You can also use static variant of Audience Network SDK provided in the download. To do this, drag and drop FBAudienceNetwork.xcframework from the Static folder
  • If you want to use the Static variant, make sure your project is using Swift. If your project doesn't use Swift, add an empty swift file (File -> New -> Swift in XCode) to your project
  • If your project is targeting iOS version earlier than 12.4, make sure to set the Always embed Swift standard libraries setting to YES, under the Build settings of your application's target in XCode.
  • To avoid adding any extra tweaks after manual installation, use CocoaPods.

Troubleshooting for SDK versions 6.9.0 and higher

Starting from 6.9.0, iOS Audience Network SDK has Swift enabled. Refer to points below in order to work through the most common problems of SDK installation & Swift interoperability:

  • XCode emits errors: 'Undefined symbol: __swift_FORCE_LOAD_$_swiftDataDetection' and 'Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider. These errors mean that you are using not the latest version of XCode. Update to XCode 13 or newer to fix this errors.
  • XCode emits many errors Undefined symbol__swift_FORCE_LOAD_$_. These errors mean that you don't have Swift support enabled for your project. The simplest way to fix this is to add an empty Swift file ('File' -> 'New' -> 'Swift file' in XCode).
  • When running on device, application crashes right after start with an error: 'dyld: Library not loaded: @rpath/FBAudienceNetwork.framework'. This error means that you didn't embed Audience Network SDK in your app. Please go to your target settings and choose 'Embed & Sign' for 'FBAudienceNetwork.xcframework' on 'General' tab.
  • Application crashes right after start with an error: 'dyld: Library not loaded: @rpath/libswiftCore.dylib'. This error means that you are running an app on iOS older than 12.4 and did not set 'YES' for "Always embed Swift standard libraries" setting. Please make sure to set "Always embed Swift standard libraries" setting to YES under "Build settings" of your application's target in XCode.