iOS Manual Implementation

iOS Manual Implementation

Prerequisites

Do iOS Get Started until finishing step 5

Step summary

  1. Add the initialization code.

  2. Add the ad wrapper views in your app.

  3. Follow our ad format guides for their implementation.

  4. Test everything is working.

  5. Change everything to production code.

  6. Your app is now prepared for monetization with us.

We only mention how to create wrappers and not triggers because the way a trigger is fetch for its use is highly dependant on your specific app code.

Wrappers and Triggers/Events are used for different formats, each ad format page tells you what you need to use (wrapper or trigger) to display it.

Initialize the SDK

We require the SDK to be initialized only once and as early as possible It can be done either inside your UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:) method or inside the first UIViewController.viewDidLoad() method.

Initialization inside the UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:) delegate method.

import UIKit import R89SDK @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // This is for testing purposes, remove it on prod R89SDK.shared.setLogLevel(level: LogLevels.debug) // This is for testing purposes, remove it on prod R89SDK.shared.setDebug() // This is for testing purposes, remove it on prod // pubUUID and apiKey are for testing purposes, remove it on prod R89SDK.shared.initialize( pubUUID: "TestRefinery89UUID", apiKey: "TestRefinery89ApiKey", singleLine: false, publisherInitializationEvents: nil ) return true } }

Your pubUUID and apiKey will be provided to you during onboarding process by email, you can also retrieve them from the web interface after login.

This apiKey is not the same GADApplicationIdentifier provided in the Info.plist in previous steps.

Add wrappers to your views

Wrappers are the UIView container inside which the ads will show. You need to add as many ad slots or ad places as you desire.

You can add the wrappers using XCode’s UI Builder or programmatically, for more see the iOS Creating a wrapper.

Follow our ad format guides.

Test Ids

All the testing values can be found within the ConfigBuilder class. In the table below, the format names are linked to their respective test IDs.

Format name

Test Id

Format name

Test Id

App Open

Automatically adds itself when on debug

Banner

ConfigBuilder.companion.BANNER_TEST_R89_CONFIG_ID

Outstream

ConfigBuilder.companion.VIDEO_OUTSTREAM_TEST_R89_CONFIG_ID

Infinite Scroll

ConfigBuilder.companion.INFINITE_SCROLL_TEST_R89_CONFIG_ID

Interstitial

ConfigBuilder.companion.INTERSTITIAL_TEST_R89_CONFIG_ID

Video Interstitial

ConfigBuilder.companion.VIDEO_INTERSTITIAL_TEST_R89_CONFIG_ID

Go into production

  • Remove the methods R89SDK.shared.setDebug().

  • Change the GADApplicationIdentifier in the info.plist for the production one.

  • Change the pubUUID and apiKey in the initialization method for the production ones.

  • Change the r89ConfigId in the formats for the production ones.

  • it’s also recommended to remove R89SDK.shared.setLogLevel(level: LogLevels.debug) but not needed.

How does it work?

We fetch all ad unit configurations from our Database and you simply need to place the ad units using the R89AdFactory and the r89ConfigurationIDs we provide you. Incorporate them into the desired views.

Check iOS - Ad Formats to see how each format is implemented.