判断APP是否已安装
2024-09-02 08:37:32
NSString *str = [NSString stringWithFormat:@"%@://%@",[dic objectForKey:@"ios_url_scheme"],[dic objectForKey:@"app_bundle_id"]];
NSURL *app_url = [NSURL URLWithString:str];
BOOL hasInstalled = [[UIApplication sharedApplication] canOpenURL:app_url];
if (hasInstalled){
//说明此设备有安装app,打开APP
if (APP_Version.doubleValue <= 10) {
[[UIApplication sharedApplication] openURL:app_url];
}else{
[[UIApplication sharedApplication] openURL:app_url options:@{} completionHandler:nil];
}
}else{
//说明此设备没有安装app,跳转APP_STORE
NSString *link = [dic objectForKey:@"app_link_ios"];
if (link.length != 0) {
NSString *link_pro = [link stringByReplacingOccurrencesOfString:@"https" withString:@"itms-apps"];
if (APP_Version.doubleValue <= 10) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:link_pro]];
}else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:link_pro] options:@{} completionHandler:nil];
}
}
}
最新文章
- 【原】SDWebImage源码阅读(五)
- iOS 学习 - 18.TextField 自定义菜单事件,复制和微信分享
- web测试常用的用例及知识
- XCode设置(怎么让代码收缩)
- SPOJ GSS4 Can you answer these queries IV
- MySql、SqlServer、Oracle 三种数据库查询分页方式
- Arch 安装步骤
- O - 覆盖的面积 - hdu 1255(求面积)
- WebView混合开发
- [国嵌笔记][013][Mini2440开发板介绍]
- 分别基于TensorFlow、PyTorch、Keras的深度学习动手练习项目
- win8.1安装win64_11gR2_database_2of2 【INS-13001]】环境不满足最低要求问题
- BZOJ2843 极地旅行社 LCT
- 今日Q群:QQ群众群友反馈问题的归纳总结
- 迷你MVVM框架 avalonjs 1.3.7发布
- ";characterEncoding"; must end with the &#39;;&#39; delimiter.
- 黄聪:使用Add-on SDK开发火狐扩展
- p2093 [国家集训队]JZPFAR
- CSS动画实例
- 【原创】ubuntu14.04 LTS系统VMware虚拟机内Windows server 2008 r2系统的网络配置