Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 8 Next »

Prerequisites

Do iOS Get Started until finishing step 3.

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.

Initialize the SDK

We require the SDK to be initialized only once as early as possible so for this purpose using the UIApplicationDelegate’s didFinishLaunchingWithOptions method or the first UIViewController’s viewDidLoad method is recomended.

Override the didFinishLaunchingWithOptions delegate method inside your UIApplicationDelegate class.

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
        // publisherId and appId are for testing purposes, remove it on prod
        R89SDK.shared.initialize(
          publisherId: "TestRefinery89ID",
          appId: "TestDemoApp",
          singleLine: false,
          publisherInitializationEvents: nil
        )
        return true
    }
}

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

This appID 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 Formats guides.

Go into production

  • Remove the methods R89SDK.shared.setDebug()

  • Change the Google app id in the manifest for the production one

  • Change the appId and publisherId 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(LogLevels.DEBUG) but not needed

  • No labels