Integration

In this article, you will learn how to integrate and initialize the Nimbus SDK into your mobile application. It will also explain how to turn test mode ON, which will allow you to test the integration

Build Setup

Swift Package Manager

  1. In Xcode, install the Nimbus iOS SDK Swift Package by navigating to File > Add Packages...

  2. In the top right of the Package Search dialog enter https://github.com/adsbynimbus/nimbus-ios-sdk.git and select the nimbus-ios-sdk in the search results.

  3. Add the NimbusKit package and any additional packages required for your integration.

    • NimbusRenderStaticKit is required for rendering static/html ads.

    • NimbusRenderVideoKit is required for rendering video/VAST ads.

  4. (Optional) NimbusFANKit, NimbusRequestAPSKit, NimbusUnityKit, and NimbusVungleKit require frameworks that do not yet support Swift Package Manager; the nimbus-ios-sdk provides targets for including these dependencies if not imported elsewhere in the application. If the dependencies are included via cocoapods, the libraries NimbusFANKit-WithoutFBAudienceNetwork, NimbusRequestAPSKit-WithoutDTBiOSSDk, NimbusUnityKit-WithoutUnityAds , and NimbusVungleKit-WithoutVungleSDK can be used instead.

Note about using Swift Packages in Dynamic Frameworks

Swift Package Manager uses static linking by default whereas the Nimbus SDK and some of its dependencies use dynamic frameworks for its binary target dependencies. Swift Package Manager will properly handle this for you if the SDK is used in another Swift Package, static framework, or directly in an app target.

If the Nimbus SDK is referenced in a dynamic framework, it cannot be referenced anywhere else in the applications build otherwise multiple copies of the SDK code will be included in the final build and will result in hard to debug runtime errors.

The Firebase iOS SDK documenation is a good source for learning more about static vs dynamic linking a framework or library from another framework.

Cocoapods

NimbusSDK requires Cocoapods >= 1.10.0.

  1. Add NimbusSDK pod to your Podfile.

  2. Include NimbusRenderStaticKit (required if displaying static interstitial/banner (HTML) ads) and/or NimbusRenderVideoKit (required if displaying video (VAST) ads) as necessary. pod 'NimbusSDK', subspecs: [`NimbusKit`, `NimbusRenderStaticKit`, `NimbusRenderVideoKit`]

  3. Run pod install

Manual

Download the latest iOS SDK.

Drag the following packages into your project:

  • NimbusCoreKit.xcframework

  • NimbusRequestKit.xcframework

  • NimbusRenderKit.xcframework

  • NimbusRenderStaticKit.xcframework (required if displaying static interstitial/banner (HTML) ads)

  • NimbusRenderVideoKit.xcframework (required if displaying video (VAST) ads)

  • NimbusKit.xcframework

  • OMSDK_Adsbynimbus.xcframework

You can add these frameworks to your main app target by including it in “Frameworks, Libraries, and Embedded Content”. Please make sure to select “Embed & Sign” for these frameworks.

Additional setup if displaying video ads

Download and include IMA SDK if your app is going to display video ads.

Currently supported IMA SDK version is 3.13.0 but other versions may work.

Initializing Nimbus SDK

import NimbusKit

Nimbus.shared.initialize(publisher: [publisher key], apiKey: [api key])
// Set up renderers. Add static and/or video renderers here as needed

import NimbusRenderStaticKit
import NimbusRenderVideoKit

Nimbus.shared.renderers = [
    .forAuctionType(.static): NimbusStaticAdRenderer(),
    .forAuctionType(.video): NimbusVideoAdRenderer(),
]

After completing the steps above, you will be able to start requesting and rendering ads into your app.

Test Mode

Enable test mode to start seeing ads right away. This is required for a first time integration.

Nimbus.shared.testMode = true

Test mode can be turned off when you are ready to test in your production environment.

How to Show an Ad

For examples of how to show ads please check out the rendering section of our documentation.

Last updated