美文网首页
iOS App间跳转

iOS App间跳转

作者: CocoaH | 来源:发表于2021-09-28 17:18 被阅读0次

A应用跳转到B应用
如下图在B应用项目中设置了URL Schemes, UrlTyps 是一个数组,可以设置多个Schemes,具体值可以随便写

image.png

B应用在info.plist - LSApplicationQueriesSchemes 中添加A应用的Schemes
一定要添加否则[UIApplication sharedApplication] canOpenURL:] 是否

image.png
 //通过以下方式跳转
    NSURL *Url = [NSURL URLWithString:@"hhSimple://com.hhAPP"];
//    NSURL *Url = [NSURL URLWithString:@"HHChat://com.hhAPP"];
    if ([[UIApplication sharedApplication] canOpenURL:Url]) {
        [[UIApplication sharedApplication] openURL:Url options:@{} completionHandler:^(BOOL success) {
            if (success) {
                
            }
        }];
    } else {
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"未安装皖税通" preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        }];
        [alert addAction:sure];
        dispatch_async(dispatch_get_main_queue(), ^{
            [self presentViewController:alert animated:YES completion:nil];
        });
    }

在appDelegate 中,通过此方法判断app从那个应用跳转过来

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
    if ([url.absoluteString containsString:@"hhSimple"]) {
        //此处可判断app从哪里跳转过来
    }
    
    return YES;
}

相关文章

  • iOS开发 App间的相互打开/跳转的配置

    iOS调研App间的相互跳转; 两个App,A和B;App内相互跳转处理: 一、scheme方式跳转 1、A --...

  • iOS 11以上跳转App评论界面

    iOS 11 以前跳转iOS App评论 iOS 11 以后跳转iOS App评论

  • iOS App间跳转

    A应用跳转到B应用如下图在B应用项目中设置了URL Schemes, UrlTyps 是一个数组,可以设置多个Sc...

  • APP 之间的跳转

    App之间跳转实现 在谈App内部的路由之前,先来谈谈在iOS系统间,不同App之间是怎么实现跳转的。 1. UR...

  • iOS App间相互跳转

    iOS系统由于其Sandbox的安全机制,系统内各App之间不能共享信息;官方给出了一些(URL Sche...

  • 2019-12-20

    IOS 键盘内部跳转 App的方法: //MARK:点击跳转App-(void)linkButtonAction{...

  • app跳转到QQ,微信,支付宝等之后是怎么返回来的

    相关app之间的跳转可以参考 iOS开发--一步步教你彻底学会『iOS应用间相互跳转』 ,写的挺详细的,这里就不用...

  • Router跳转

    ios APP跳转发生在这么几个地方:1.APP内部UIViewController之间。2.APP跳转其他APP...

  • iOS 10 改动

    iOS 10 关闭了App对设置中的跳转 ,只能跳转到本App的设置中

  • iOS10适配:被弃用的openURL

    苹果在iOS 2中引入了openURL:方法来进行APP间的跳转。不过在iOS9中,相关的canOpenURL:函...

网友评论

      本文标题:iOS App间跳转

      本文链接:https://www.haomeiwen.com/subject/lmdrnltx.html