Open buoge opened 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 即可
}
}
}
}
}
在 xcode9 swift 3 模式下,文档中的代码各种提示错误,烦请验证一下!!!