iOS 10跳转到其他app
- (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的更多相关文章
- iOS 10 跳转系统设置
苦心人天不负, 为了项目终于把 iOS 10 跳转系统设置的方法给搞定了, 很欣慰. http://www.cnblogs.com/lurenq/p/6189580.html iOS 10 跳转系统设 ...
- iOS 10 的坑:新机首次安装 app,请求网络权限“是否允许使用数据”(转)
症状 iOS 10 之后,陆陆续续地有用户联系我们,说新机第一次安装.第一次启动的时候,app 首屏一片空白,完全没数据.kill 掉重新打开就好了. 一开始以为是用户网络情况不好,但随着越来越多的用 ...
- 在 iOS 10.0 之后, App 要调用手机相机与相簿应注意的事项
iOS 的 SDK 每一年至少都会有一次大改版,从 2009 到 2016 年,版号已经到了第 10 版了,很轻易的就追上了 Mac OSX. 每一次的大改版都会有不少新的功能或新的规范,在 iOS ...
- iOS应用跳转到App Store评分
iOS应用跳转到App Store评分 1.跳转到应用评价页 NSString *urlStr = [NSString stringWithFormat:@"itms-apps://itun ...
- iOS 10 适配 ATS(app支持https通过App Store审核)
iOS 10 适配 ATS 一. HTTPS 其实HTTPS从最终的数据解析的角度,与HTTP没有任何的区别,HTTPS就是将HTTP协议数据包放到SSL/TSL层加密后,在TCP/IP层组成IP数据 ...
- iOS 10.3+ 动态修改 App 图标
支持系统: iOS 10.3+ tvOS 10.2+ Apple 官方文档 官方 API: @interface UIApplication (UIAlternateApplicationIcons) ...
- 【腾讯Bugly干货分享】聊聊苹果的Bug - iOS 10 nano_free Crash
本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:https://mp.weixin.qq.com/s/hnwj24xqrtOhcjEt_TaQ9w 作者:张 ...
- [转载]iOS 10 UserNotifications 框架解析
活久见的重构 - iOS 10 UserNotifications 框架解析 TL;DR iOS 10 中以前杂乱的和通知相关的 API 都被统一了,现在开发者可以使用独立的 UserNotifica ...
- iOS 10 开发问题总结
兼容iOS 10 资料整理笔记 1.Notification(通知) 自从Notification被引入之后,苹果就不断的更新优化,但这些更新优化只是小打小闹,直至现在iOS 10开始真正的进行大 ...
随机推荐
- Agile敏捷开发Planning Poker简介
关注嘉为科技,获取运维新知 一.为什么不用“人天”? 传统的IT项目,尤其是软件开发项目,往往使用“人天”来作为工作量评估的量词.甚至是代表一种评估方式.在软件项目开发经典著作<人月神话&g ...
- 使用scrapy-crawlSpider 爬取tencent 招聘
Tencent 招聘信息网站 创建项目 scrapy startproject Tencent 创建爬虫 scrapy genspider -t crawl tencent 1. 起始url sta ...
- python记录_day01 初始
一.python介绍 python的创始人为吉多·范罗苏姆(Guido van Rossum),人称龟叔.目前python主要应用于web开发.云计算.科学计算.人工智能.系统运维.金融.图形GUI等 ...
- 基于Helm和Operator的K8S应用管理的分享
一.为啥要用helm 对于一些微服务架构来说,会有不同的服务在上面运行,你可能要管理诸如deployment.service.有状态的Statefulset.权限的控制等等.你会发现,部署应用后还会有 ...
- leetcode-algorithms-33 Search in Rotated Sorted Array
leetcode-algorithms-33 Search in Rotated Sorted Array Suppose an array sorted in ascending order is ...
- Github 指令上手 --- 分支
指令环境 Git Shell 1.创建一个新分支 git branch branchName 2.切换到新创建的分支 git checkout branchName 1.2合起来使用指令(创建并切换) ...
- [luogu P2319] [HNOI2006]超级英雄
[luogu P2319] [HNOI2006]超级英雄 题目描述 现在电视台有一种节目叫做超级英雄,大概的流程就是每位选手到台上回答主持人的几个问题,然后根据回答问题的多少获得不同数目的奖品或奖金. ...
- vijos1448校门外的树
描述 校门外有很多树,有苹果树,香蕉树,有会扔石头的,有可以吃掉补充体力的……如今学校决定在某个时刻在某一段种上一种树,保证任一时刻不会出现两段相同种类的树,现有两个操作:K=1,K=1,读入l.r表 ...
- ScheduledThreadPoolExecutor
java提供了方便的定时器功能,代码示例: public class ScheduledThreadPool_Test { static class Command implements Runnab ...
- iptables报错:Couldn't load target `accept':/lib64/iptables/libipt_accept.so: cannot open shared object file: No such file or directory
语句:iptables -A INPUT -s 134.192.204.235 -p TCP --dport 11211 -j accept 报错:Couldn't load target `acce ...