Commit feccac02 authored by pete谢兆麟's avatar pete谢兆麟

添加打开外部链接的方法

parent 269c30b1
......@@ -804,4 +804,24 @@ extension YHJsApi {
})
}
}
@objc func jumpToBrowser(_ url: String) {
DispatchQueue.main.async {
if let url = URL(string: url) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url) { success in
if success {
printLog("成功打开URL")
} else {
printLog("无法打开URL")
}
}
} else {
printLog("无法处理此URL")
}
} else {
printLog("URL格式错误")
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment