info.plist 中需要添加(实测没填写的话不会去判断是否安装了此APP)
需要跳转的按钮点击事件: func copyStrKey(_ sender: UIButton) { let pboard = UIPasteboard.general pboard.string = self.productModel["search_key"].stringValue var titleStr = "" var jumpStr = "" if sender.tag == 0 { titleStr = "关键词复制成功,是否跳转到手机淘宝APP?" jumpStr = ("taobao://s.taobao.com/search?q=" + self.productModel["search_key"].stringValue).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! } else if sender.tag == 1 { titleStr = "淘口令复制成功,是否跳转到手机淘宝APP?" jumpStr = "taobao://item.taobao.com/item.htm" } let alertCtr = UIAlertController.init(title: titleStr, message: nil, preferredStyle: UIAlertControllerStyle.alert) alertCtr.addAction(UIAlertAction.init(title: "取消", style: UIAlertActionStyle.cancel, handler: nil)) alertCtr.addAction(UIAlertAction.init(title: "确定", style: UIAlertActionStyle.default, handler: { (action) in if let url = URL.init(string: jumpStr) { if UIApplication.shared.canOpenURL(url) == true { UIApplication.shared.openURL(url) } else { let alertC = UIAlertController.init(title: "您未安装手机淘宝APP,是否前往AppStore下载安装?", message: nil, preferredStyle: UIAlertControllerStyle.alert) alertC.addAction(UIAlertAction.init(title: "取消", style: UIAlertActionStyle.cancel, handler: nil)) alertC.addAction(UIAlertAction.init(title: "确定", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction) in let AppStoreVC = UIViewController.init() AppStoreVC.modalTransitionStyle = UIModalTransitionStyle.coverVertical let webView = UIWebView.init(frame: AppStoreVC.view.bounds) let request = NSURLRequest.init(url: URL.init(string: "itms-apps://itunes.apple.com/cn/app/tao-bao-sui-shi-sui-xiang/id387682726?mt=8")!) //AppStore手机淘宝地址 webView.loadRequest(request as URLRequest) AppStoreVC.view.addSubview(webView) self.present(AppStoreVC, animated: true, completion: { AppStoreVC.dismiss(animated: true, completion: nil) }) })) self.present(alertC, animated: true, completion: nil) } } })) self.present(alertCtr, animated: true, completion: nil) }说明:
URL 不能包含 ASCII 字符集中, 不是必须这样的字符进行转义的字符。
使用 stringByAddingPercentEncodingWithAllowedCharacters
字符集 URLQueryAllowedCharacterSet
1、首页
tmall://tmallclient/
2、详情(需要id)
tmall://page.tm/itemDetail?id=556107550107
3、搜索列表
tmall://page.tm/search?q=1234
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/16908.html
摘要:而未来的互联网网络链路日趋复杂,加重了安全事件发生。苹果强制开启标准苹果宣布年月日起,所有提交到的必须强制开启安全标准,所有连接必须使用加密。最后是安全意识。 互联网发展20多年,大家都习惯了在浏览器地址里输入HTTP格式的网址。但前两年,HTTPS逐渐取代HTTP,成为传输协议界的新宠。早在2014年,由网际网路安全研究组织Internet Security Research Gr...
摘要:下面,我们邀请阿里巴巴淘宝技术部资深技术专家,天猫未来店技术负责人时维,为大家分享天猫未来店背后的技术本文根据云栖大会演讲整理而成。总结下来,阿里无人店开发的宗旨就是两句话首先,技术上我是要追求无人的能力,但不迎合无人的体验。 showImg(https://segmentfault.com/img/remote/1460000016760894); 今年云栖大会现场一大网红打卡地莫过...
摘要:首先了解一下淘宝双促中的长列表模块,也就是类型的模块。在模块渲染数据时,会将数据发送给页面的,判断这是一组数据时进行真实数据的渲染小结第一次接受淘宝双促的考验,在化性能稳定性等多个方面表现优异,达成了预定的目标。 showImg(https://segmentfault.com/img/remote/1460000009614810); Rax is a universal JavaS...
摘要:首先了解一下淘宝双促中的长列表模块,也就是类型的模块。在模块渲染数据时,会将数据发送给页面的,判断这是一组数据时进行真实数据的渲染小结第一次接受淘宝双促的考验,在化性能稳定性等多个方面表现优异,达成了预定的目标。 showImg(https://segmentfault.com/img/remote/1460000009614810); Rax is a universal JavaS...
阅读 440·2023-04-26 02:03
阅读 831·2021-11-23 09:51
阅读 812·2021-10-14 09:42
阅读 1527·2021-09-13 10:23
阅读 760·2021-08-27 13:12
阅读 716·2019-08-30 11:21
阅读 893·2019-08-30 11:14
阅读 788·2019-08-30 11:09