检测是否安装第三方APP,并下载;以WPS为例

判断是否安装第三方软件,并且打开跳转到AppStore下载地址

第一步 添加scheme

在info配置处,URL type添加需要打开第三方软件的标示 或者直接在info下添加 key

LSApplicationQueriesSchemes

第二步 以我们刚才添加的标示 对应上面的 item 0对应的值

这里以APP内打开WPS为例,直接上代码

          if(![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"KingsoftOfficeApp://"]]){
            
                    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"未安装WPS,点击确定进入AppStore下载"       preferredStyle:UIAlertControllerStyleAlert];
                   UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                
            }];
            UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                NSString *str = [NSString stringWithFormat: @"https://itunes.apple.com/cn/app/wps-office/id599852710?mt=8"];
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
                
            }];
            [alertController addAction:action1];
            [alertController addAction:action2];
            [self presentViewController:alertController animated:YES completion:nil];

这样就实现了 检测并打开第三方软件。

猜你喜欢

转载自blog.csdn.net/wangxiaoertedaye/article/details/52625172