WFC-LinkedME / LinkedME-iOS-Deep-Linking-Demo

LinkedME是国内首家企业级深度链接服务平台,致力于帮助App提高用户增长和流量变现。LinkedME采用Deep Linking,Deferred Deep Linking,Contextual Deep Linking, Machine Learning等技术,为移动产品提供全新的商业价值。
http://www.linkedme.cc
MIT License
35 stars 5 forks source link

注册代码支持swift3 #4

Open buoge opened 6 years ago

buoge commented 6 years ago

在 xcode9 swift 3 模式下,文档中的代码各种提示错误,烦请验证一下!!!

buoge commented 6 years ago

/// 注册LinkedME 深度链接服务 static func registeService(launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil){

    // Override point for customization after application launch.
    let linkedme = LinkedME.getInstance();

    //是否开启Debug模式,开启Debug模式将会打印日志,上线时请关闭Debug模式
    linkedme?.setDebug();

    //解析深度链获取跳转参数,开发者自己实现参数相对应的页面内容。
    linkedme?.initSession(launchOptions: launchOptions, automaticallyDisplayDeepLinkController: false){ (params, error) in
        if(error != nil){
            print(error ?? "call back with param error");
        }else{
            //[AnyHashable : Any]?
            //print("LinkedME finished init with params\(params)")
            guard let paramsDictionary = params as NSDictionary? else {
                return
            }
            // $control 里面的参数是自己这边生成深度链接的自定义参数,可能在服务端,可能在web前端
            let controlObj =  paramsDictionary["$control"]
            if let controlDict = controlObj as? NSDictionary {
                if let customerParam = controlDict["customerParam"] as? String {
                    print("LinkedME customerParam is \(customerParam)")
                    // 根据其它端传递过来的自定义参数跳转到对应的controller 即可

                }
            }
        }
    }

}