Initialization and Release
Before using any features of the SDK, you must initialize it in your OTT app's startup process. Set the operating environment mode to either local, dev, or prod as described below.
- local: This mode can be used in a local environment and the default log level is Verbose.
- dev: This mode can be used in a development environment and in this mode, the error log that is generated in the SDK is saved in the server. The default log level is Info.
- prod: This mode can be used in a commercial environment and in this mode, the error log that is generated in the SDK is saved in the server. The default log level Warn.
When using SwiftUI, we recommend initializing the SDK using AppDelegate via UIApplicationDelegateAdaptor.
note
The iOS SDK does not require an explicit release/destroy call. Resources are managed internally.
SwiftUI
import UIKit
import SwiftUI
import FlowerSdk
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FlowerSdk.setEnv(env: "local")
FlowerSdk.doInit()
return true
}
}
@main
struct YourApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
...
}
}
UIKit
import UIKit
import FlowerSdk
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FlowerSdk.setEnv(env: "local")
FlowerSdk.doInit()
return true
}
}