Home  >  iOS  >  Ver.2.1.0

Initialization

Test about Deeplinking:

var mps: MPS!
    
public func application(_ application: UIApplication, didFinishLaunchingWithOptions
    launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
    _ = MPSShared.default


    let testMode = shouldEnableTestMode(mpsTestKey: "testmode", options: launchOptions)
    let options = MPSOptions(testMode: testMode)

    mps = MPS(url: URL(string: "https://mps.nbcuni.com")!, site: "test-sdk", options: options)
    return true
}

func shouldEnableTestMode(mpsTestKey: String, options: [UIApplicationLaunchOptionsKey : Any]?) -> Bool {
    if let startUrl = options?[UIApplicationLaunchOptionsKey.url] as? URL {
        let result = startUrl.absoluteString.contains(mpsTestKey)
        return result
    }
    
    return false
}