判断APP是否已安装
Posted 小师傅啊小师傅
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了判断APP是否已安装相关的知识,希望对你有一定的参考价值。
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]; } } }
以上是关于判断APP是否已安装的主要内容,如果未能解决你的问题,请参考以下文章