Skip to main content

Prerequisites

Targeting

  • Use Xcode 16.0 or higher.
  • Target iOS 17.2 or higher.

Updating your Info.plist

  1. Before installing, update the application Info.plist to A GADApplicationIdentifier key with a string value of your Ad Manager app ID found in the Ad Manager UI and of the form ca-app-pub-################~##########. If you do not have this ID, please contact the Content Ignite team.
  2. Next add a SKAdNetworkItems key to your Info.plist with SKAdNetworkIdentifier values for Google (cstr6suwn9.skadnetwork) and select third-party buyers who have provided these values to Google.

Installation

Use of the following methods to install the Content Ignite Mobile SDK.

Swift Package Manager

To install the SDK into your project using Swift Package Manager:
  1. In Xcode, install the Content Ignite Mobile SDK UIKit Package using File > Add Package Dependencies…
  2. When the prompt appears, search for the following URL for the UIKit version of the SDK:
https://gitlab.com/content-ignite/content-ignite-mobile-sdk-ios-uikit
  1. Select the version of the Content Ignite Mobile SDK UIKit Package you want to use. For new projects, we recommend using the Up to Next Major Version.

CocoaPods

Before you continue, review Using CocoaPods for information on creating and using Podfiles. To install the SDK into your project using CocoaPods:
  1. Open your project’s Podfile and add this line to your app’s target build configuration:
pod 'Content-Ignite-Mobile-UIKit'
  1. In a terminal, run:
pod install --repo-update
  1. In your project’s build settings:
  • Add the -ObjC linker flag to Other linker flags.

Initialising the SDK

First we will create an instance of CIMobileAdsConfiguration. This is achieved using CIMobileAdsConfiguration.Builder. The builder takes one required parameter:
  • publisherId: String: A unique identifier to identify the publisher in the Fusion platform.
Then call the build API to create the instance.
ℹ️ When creating an instance of CIMobileAdsConfiguration it is possible to enable optional features on the SDK, currently the only feature which can be enabled is debugging using the setDebugFeature API. This is discussed further in the Using the Debug Features section.
let configuration = CIMobileAdsConfiguration.Builder(
    publisherId: "<PUBLISHER-ID>"
)
.setDebugFeature(enabled: true)
.setTestAds(enabled: true)
.build()
  • setTestAds(enabled: Boolean) was added to CIMobileAdsConfiguration.Builder in 1.7.0 to control whether test ads are enabled, this was previously only possible from the debug menu. If this is set the Debug Menu option will be hidden and if not set the Debug Menu option will be used.
Next we pass this configuration into the singleton instance CIMobileAds initialise API. This is an async-await function. It takes one required parameter:
  • configuration: An instance of CIMobileAdsConfiguration.
The call to initialise the SDK should be made as early as possible in the application lifecycle.
ℹ️ If you are currently using Google Mobile Ads SDK, it is no longer necessary to initialise this separately, and this code should be removed.
An example is shown below:
import CIMobileSDK

class AppDelegate: UIResponder, UIApplicationDelegate {
    
    func application(
        _ application: UIApplication, 
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
        ) -> Bool {
        
        let configuration = CIMobileAdsConfiguration.Builder(
            publisherId: "<PUBLISHER-ID>"
        )
        .setDebugFeature(enabled: true)
        .build()

        Task {
            let status = try await CIMobileAds.shared.initialise(
                configuration: configuration
            )
            switch status {
            case .succeeded:
                print("CIMobileSDK initialisation succeeded")
            case .failed:
                print("CIMobileSDK initialisation failed")
            }
        }
        
        return true
    }
}

Select an ad format

Content Ignite Mobile SDK is now imported and you’re ready to implement an ad. We offer a number of different formats:

App Open

Ads that appear when a user opens or switches back to your app. Flexibily sized format for placing ads anywhere in your app.

Interstitial

Full-screen ads that are designed to appear between content transitions.