@objc func btn4Act() {//跳转拼多多
var bSucc: Bool = false
let reqUrl: String = "pinduoduo://com.xunmeng.pinduoduo/"
if #available(iOS 10, *) {
UIApplication.shared.open(reqUrl.url!, options: [:], completionHandler: { (success) in
// print("跳转是否成功?\(res)")
// if success as Bool {
bSucc = success
if !bSucc {
let alertController = UIAlertController(title: "提示",
message: "您手机中未安装拼多多,该功能受限", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "我知道了", style: .cancel, handler:{
action in
})
alertController.addAction(cancelAction)
self.present(alertController, animated: true, completion: nil)
}
// }
})
}else {
bSucc = UIApplication.shared.openURL(reqUrl.url!)
if !bSucc {
let alertController = UIAlertController(title: "提示",
message: "您手机中未安装拼多多,该功能受限", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "我知道了", style: .cancel, handler:{
action in
})
alertController.addAction(cancelAction)
self.present(alertController, animated: true, completion: nil)
}
}
网友评论