Skip to end of metadata
Go to start of metadata

iOS SDK Migration and Integration

This page describes how to integrate our SDK with your project.

For instructions on showing different ad types, see:

Follow the instructions in this section to set up our SDK to show ads in your app.


This SDK requires MacOS X 10.7+ and Xcode version 6.0+.

In order to show ads, you must have a valid Xandr placement ID. 

App Transport Security

iOS 9 introduced a new privacy feature called App Transport Security (ATS). ATS blocks non-HTTPS requests by default.

To show ads using our SDK, you must include the following exception in the info.plist file of each app which contains our SDK:


If you are using v2.13 or greater of our SDK and would like to show only ATS-compliant ads, you can enable HTTPS ads in your app using the instructions in Request Ads over HTTPS.


Step 1. Get and install the SDK

There are four ways to get our SDK:

  • CocoaPods
  • Carthage
  • Download from source
  • As a framework


If you are unfamiliar with CocoaPods review their installation and user guides. Once you have CocoaPods installed: 

Use Terminal or your command line editor of choice, navigate to the root directory of your project and create a podfile. 

Using a text editor, open the newly created podfile. Set the platform version to 9.0 and add pod 'AppNexusSDX' to the target. 

Save your changes and return to Terminal and enter: 

CocoaPods will download the Xandr SDK and create a workspace in the project directory. If your project is currently open, close it and open the workspace. 


If you are unfamiliar with Carthage review their installation and user guides. Open the and navigate to the root directory of your project. Create a Cartfile. 

Open the file in Xcode to edit it. 

Add the following line to the file.

You can use editor's other than Xcode to edit the Cartfile but be aware that other editing programs such as TextEdit might automatically include smart quotes instead of straight quotes. Carthage will not recognize content within smart quotes and not perform correctly. 

Add the SDK to your project

Download from source

Download and unzip or clone the latest release of our SDK from our Github Release page.

Once the source from Github is downloaded, link the AppNexusSDK.Xcodeproj in your Xcode project.

  1. Open the app’s Xcode project or workspace. Right click on Project and Click on Add Files to "Project Name".  

  2. Go to AppNexusSDK project folder and select the AppNexusSDK.Xcodeproj.  Make sure to select Copy items if needed and select finish.

  3. Click  Link Binary With Libraries (Target->General->Link Binary With Libraries) and select AppNexusSDK.framework.

 As a framework

  1. Download and unzip the latest version of of our SDK from Github Releases page. AppNexus Framework is distributed in three types: 

    • Simulator: Contains only Simulator architectures i386 x86_64 

    • Device: Contains only phone architectures armv7 and arm64
    • Universal: Contains both Simulator and device architectures

Use the one which is most appropriate for you testing. But Device framework needs to be used when doing app store submission.

2. Add the AppNexusSDK.framework to the Embedded Binaries:

a. Open the app’s Xcode project or workspace. 

b. Go to the app target’s General configuration page.

c. Add the AppNexusSDK.framework to the Embedded Binaries(Target->General->Embedded Binaries) section by clicking the Add icon. Do not drag in the framework from Finder. 


d. Select Add Other and navigate to the location where you have unzipped the AppNexusSDK.framework and select Open.


e. Select Copy items if needed and select Finish.


  • Remove unused  simulators architectures if using universal framework.

Step 2. Add the required iOS frameworks.

Add the iOS frameworks listed below. To add them, click your application's target. Then click Build Phases, and Link Binary with Libraries to enter the frameworks.

The list below includes all frameworks and libraries required to build the full SDK tarball as released to Github. You may not need all of these if you are building the SDK yourself, without all of the third-party SDK integrations.

  • AdSupport.framework

  • AudioToolbox.framework

  • AVFoundation.framework

  • CFNetwork.framework

  • CoreGraphics.framework

  • CoreTelephony.framework

  • EventKit.framework

  • Foundation.framework

  • MediaPlayer.framework

  • MessageUI.framework

  • MobileCoreServices.framework

  • PassKit.framework

  • QuartzCore.framework

  • Security.framework

  • Social.framework

  • StoreKit.framework

  • SystemConfiguration.framework

  • UIKit.framework

  • MillennialMedia.framework (if you use the Millennial SDK)

  • CoreMedia
  • libz.tbd

Developers working in Swift will require two additional frameworks:

  • EventKitUI.framework
  • WebKit.framework

Step 3. Add Linker Flags

In Xcode, under the Build Settings tab scroll down to the Linking sectionn and add -ObjC to the Other Linker Flags box.

Step 4. Set up for mediation (optional)

For instructions on getting set up for mediation, see Mediate with iOS.

Migrating from iOS SDK 5.x to 6.0

With the transition to a dynamic framework and the removal of the mediation adapters as part of the AppNexus SDK, apps using a Xandr 5.x version should follow these instructions for migrating their app to the Xandr 6.0 version. 


There is no change for migrating from Xandr SDK 5.x to 6.0. 

Download from source

To migrate from Xandr SDK 5.x to 6.0 from our source code: 

  1. Remove the current Xandr SDK from your project.
  2. Follow the instructions for integrating the Xandr SDK from source
  3. Navigate to the mediation folder and include the required mediation adapter files for your project.

As a framework

To migrate from Xandr SDK 5.x to 6.0 as a framework:  

  1. Remove the current AppNexusSDK static library.
  2.  Remove all the associated AppNexusSDK header files.
  3.  Download the new AppNexusSDK dynamic framework.
  4.  Change the imports from #import "ANBannerAdView.h"  to  #import <AppNexusSDK/AppNexusSDK.h>.

Related Topics