Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Step

...

summary

  1. Add The initialization code.

  2. Create the Channel between web and native with R89SDK.shared.configureWebView() method.

  3. Use R89SDK.shared.loadUrlWithConsentDataOrWait() to load your URLs into the web view.

  4. Test everything is working.

  5. Change everything to production code.

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

...

Info

If you want to have native ads to be triggered from the webview we recommend using the manual configuration alongside some kind of javascript interface implemented in the web side to trigger native code, although first finish this whole guide and then go to the manual

Create the

...

channel

Right after Initialization, you should use the following methods

Code Block
languageswift
import UIKit
import R89SDK
import WebKit

class ViewController: UIViewController, WKNavigationDelegate {
    
    @IBOutlet var wkWebView: WKWebView!
    ...

    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        let url = <YOUR-URL>
      
        wkWebView.navigationDelegate = self
        
        // This helps the channel to identify this as an app
        let userAgent = R89SDK.shared.getUserAgent(
                          webView: wkWebView, 
                          siteName: <YOUR-SITE-NAME>)
                          
        R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)
        ...        
    }
}

...

Use the following method to replace any webview.load() methods method usages you might have

Code Block
languageswift
R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)
Note

This url must only be the urls related to you content, or own. Other urls can be loaded normally. with webview.loadUrl()

Go into production

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

  • Change the GADApplicationIdentifier in the info.plist 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(level: LogLevels.debug) but not needed.

...