zoukankan      html  css  js  c++  java
  • iOS应用打开其他程序

    在程序页面进入iTunes

     NSString *appid = @"717804289";

            NSString *str = [NSString stringWithFormat:

                             @"itms-apps://itunes.apple.com/cn/app/id%@?mt=8", appid];

            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

     

    打电话:

    ——————————————— 方法一 ———————————————

    // 弊端:使用该方法进行拨号之后,当电话挂断之后不会返回应用程序, 会停留在通话记录界面,降低了用户体验,不建议使用

            NSURL *url = [NSURL URLWithString:@"tel://13261936021"];

            [[UIApplication sharedApplication] openURL:url];

            

    ——————————————— 方法二 ———————————————

            // 在拨打电话之后会提示用户是否拨打, 当电话挂断之后会返回应用程序,能达到理想的用户体验,但是它是苹果公司内部专用,不要使用(上架审核不会通过)

            NSURL *url = [NSURL URLWithString:@"telprompt://13261936021"]; 

    [[UIApplication sharedApplication] openURL:url];

    ——————————————— 方法三  ———————————————
    // 建议使用
     [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"tel://13261936021"]]];
     
    打开其他程序
    协议头:// bundle Identifier  —— 打开应用程序
     
     NSString *path = [NSString stringWithFormat:@"%@://%@", product.scheme, product.identifier];

        NSURL *url = [NSURL URLWithString:path];

         // 2.判断能否打开应用

        UIApplication *app = [UIApplication sharedApplication];

        if ([app canOpenURL:url]) {

            // 2.打开应用程序

            [app openURL:url];

        }else

        {   

    // 没有安装应用程序就跳转到AppStore    product.url = "url": "http://itunes.apple.com/app/id415424368?mt=8"

            [[UIApplication sharedApplication] openURL:[NSURL URLWithString: product.url]];

        }

        

  • 相关阅读:
    2020软件工程作业06
    2020软件工程作业05
    jdk13.0.2安装完成后,使用binjlink.exe 命令配置jre报错
    软件工程04(已报废)
    2020软件工程作业03
    软件工程问题解决清单
    软件工程作业02
    2020软件工程作业01
    2020软件工程个人作业06——软件工程实践总结作业
    2020软件工程作业05
  • 原文地址:https://www.cnblogs.com/Fc-ios/p/3802811.html
Copyright © 2011-2022 走看看