- (BOOL)jumpsToThirdAPP:(NSString *)urlStr{
if ([urlStr hasPrefix:@"mqq"] ||
[urlStr hasPrefix:@"weixin"] ||
[urlStr hasPrefix:@"alipay"]) {
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlStr] options:@{} completionHandler:nil];
return YES;
} else {
BOOL success = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlStr]] ;
if (success) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
}else{
NSString *appurl = [urlStr hasPrefix:@"alipay"]?@"https://itunes.apple.com/cn/app/%E6%94%AF%E4%BB%98%E5%AE%9D-%E8%AE%A9%E7%94%9F%E6%B4%BB%E6%9B%B4%E7%AE%80%E5%8D%95/id333206289?mt=8":([urlStr hasPrefix:@"weixin"]?@"https://itunes.apple.com/cn/app/%E5%BE%AE%E4%BF%A1/id414478124?mt=8":@"https://itunes.apple.com/cn/app/qq/id444934666?mt=8");
NSString *title = [urlStr hasPrefix:@"mqq"]?@"QQ":([urlStr hasPrefix:@"weixin"]?@"微信":@"支付宝");
NSString *titleString = [NSString stringWithFormat:@"该设备未安装%@客户端",title];
UIAlertController *controller = [UIAlertController alertControllerWithTitle:nil message:titleString preferredStyle:UIAlertControllerStyleAlert]; [controller addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { }]]; [controller addAction:[UIAlertAction actionWithTitle:@"立即安装" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSURL *url = [NSURL URLWithString:appurl];
[[UIApplication sharedApplication] openURL:url];
}]];
[self presentViewController:controller animated:YES completion:nil];
}
return YES; } } return NO;
}

或者使用url scheme来进行跳转,相对简单,但是有拒绝风险

iOS 10跳转到其他app的更多相关文章

  1. iOS 10 跳转系统设置

    苦心人天不负, 为了项目终于把 iOS 10 跳转系统设置的方法给搞定了, 很欣慰. http://www.cnblogs.com/lurenq/p/6189580.html iOS 10 跳转系统设 ...

  2. iOS 10 的坑:新机首次安装 app,请求网络权限“是否允许使用数据”(转)

    症状 iOS 10 之后,陆陆续续地有用户联系我们,说新机第一次安装.第一次启动的时候,app 首屏一片空白,完全没数据.kill 掉重新打开就好了. 一开始以为是用户网络情况不好,但随着越来越多的用 ...

  3. 在 iOS 10.0 之后, App 要调用手机相机与相簿应注意的事项

    iOS 的 SDK 每一年至少都会有一次大改版,从 2009 到 2016 年,版号已经到了第 10 版了,很轻易的就追上了 Mac OSX. 每一次的大改版都会有不少新的功能或新的规范,在 iOS ...

  4. iOS应用跳转到App Store评分

    iOS应用跳转到App Store评分 1.跳转到应用评价页 NSString *urlStr = [NSString stringWithFormat:@"itms-apps://itun ...

  5. iOS 10 适配 ATS(app支持https通过App Store审核)

    iOS 10 适配 ATS 一. HTTPS 其实HTTPS从最终的数据解析的角度,与HTTP没有任何的区别,HTTPS就是将HTTP协议数据包放到SSL/TSL层加密后,在TCP/IP层组成IP数据 ...

  6. iOS 10.3+ 动态修改 App 图标

    支持系统: iOS 10.3+ tvOS 10.2+ Apple 官方文档 官方 API: @interface UIApplication (UIAlternateApplicationIcons) ...

  7. 【腾讯Bugly干货分享】聊聊苹果的Bug - iOS 10 nano_free Crash

    本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:https://mp.weixin.qq.com/s/hnwj24xqrtOhcjEt_TaQ9w 作者:张 ...

  8. [转载]iOS 10 UserNotifications 框架解析

    活久见的重构 - iOS 10 UserNotifications 框架解析 TL;DR iOS 10 中以前杂乱的和通知相关的 API 都被统一了,现在开发者可以使用独立的 UserNotifica ...

  9. iOS 10 开发问题总结

    兼容iOS 10 资料整理笔记   1.Notification(通知) 自从Notification被引入之后,苹果就不断的更新优化,但这些更新优化只是小打小闹,直至现在iOS 10开始真正的进行大 ...

随机推荐

  1. Python2 - MySQL适配器 MySQLdb

    本文实例讲述了python中MySQLdb模块用法.分享给大家供大家参考.具体用法分析如下: MySQLdb其实有点像php或asp中连接数据库的一个模式了,只是MySQLdb是针对mysql连接了接 ...

  2. nodejs实现文件的拷贝复制

    var fs = require( 'fs' ), stat = fs.stat; /* 05 * 复制目录中的所有文件包括子目录 06 * @param{ String } 需要复制的目录 07 * ...

  3. 猫眼电影爬取(一):requests+正则,并将数据存储到mysql数据库

    前面讲了如何通过pymysql操作数据库,这次写一个爬虫来提取信息,并将数据存储到mysql数据库 1.爬取目标 爬取猫眼电影TOP100榜单 要提取的信息包括:电影排名.电影名称.上映时间.分数 2 ...

  4. linux服务器规格查看

    性能测试前,需要确定服务器规格. 下面汇总下如何查看linux的CPU等规格 1. 查看服务器CPU个数 1)查看物理CPU个数: cat /proc/cpuinfo |grep "phys ...

  5. FreeBSD之基本配置

    1. 设置IP地址.网关ee /etc/rc.conf ifconfig_em0="inet 192.168.21.173 netmask 255.255.255.0"   #设置 ...

  6. 【调试】Idea如何远程debug之SpringBoot jar包启动

    一.Java -jar启动添加如下参数 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address= -Xdebug是通知JVM工 ...

  7. 关于ActionBar 左侧添加完返回后 点击无效的问题

    ActionBar actionBar =getSupportActionBar(); if(actionBar!=null){ actionBar.setHomeAsUpIndicator(R.mi ...

  8. 从早期 Spring Boot 版本升级

    如果你现在正在从早期的 Spring Boot 版本进行升级的话,请访问 “migration guide” on the project wiki 页面,这个页面提供了有关升级的详细指南.同时也请查 ...

  9. Symmetric Tree leetcode java

    问题描述: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). ...

  10. 第一阶段——站立会议总结DAY05

    1.昨天做了什么:昨天在个人中心页面上又进行了加工,排版更加规则. 2.今天准备做什么:准备继续学习从网上下载的资料. 3.遇到的困难:界面只能是简陋的,不知道如何办到像微信那样的好看.