• iOS开发学习笔记(OC语言)——调起APP(URL Scheme)


    通过URL Scheme调起APP

    1. 在 Info.plist 中添加url scheme白名单
        <key>LSApplicationQueriesSchemes</key>
         <array>
            <!-- 微信 URL Scheme 白名单-->
            <string>wechat</string>
            <string>weixin</string>
    
            <!-- 新浪微博 URL Scheme 白名单-->
            <string>sinaweibohd</string>
            <string>sinaweibo</string>
            <string>sinaweibosso</string>
            <string>weibosdk</string>
            <string>weibosdk2.5</string>
    
            <!-- QQ、Qzone URL Scheme 白名单-->
            <string>mqqapi</string>
            <string>mqq</string>
            <string>mqqOpensdkSSoLogin</string>
            <string>mqqconnect</string>
            <string>mqqopensdkdataline</string>
            <string>mqqopensdkgrouptribeshare</string>
            <string>mqqopensdkfriend</string>
            <string>mqqopensdkapi</string>
            <string>mqqopensdkapiV2</string>
            <string>mqqopensdkapiV3</string>
            <string>mqzoneopensdk</string>
            <string>wtloginmqq</string>
            <string>wtloginmqq2</string>
            <string>mqqwpa</string>
            <string>mqzone</string>
            <string>mqzonev2</string>
            <string>mqzoneshare</string>
            <string>wtloginqzone</string>
            <string>mqzonewx</string>
            <string>mqzoneopensdkapiV2</string>
            <string>mqzoneopensdkapi19</string>
            <string>mqzoneopensdkapi</string>
            <string>mqzoneopensdk</string>
    
            <!-- 支付宝  URL Scheme 白名单-->
            <string>alipay</string>
            <string>alipayshare</string>
    
        </array>
    
    1. 判断是否能调起,否则安装
    NSURL *urlScheme = [NSURL URLWithString:@"weixin://"];
    if (![[UIApplication sharedApplication]canOpenURL:urlScheme]) {
        urlScheme = [NSURL URLWithString:@"itms-apps://itunes.apple.com/app/apple-store/id414478124"];
        NSLog(@"no weixin");
    }
    [[UIApplication sharedApplication]openURL:urlScheme options:nil completionHandler:^(BOOL success) {
        NSLog(@"success:%s", success ? "yes": "no");
    }];
    

    APP添加url scheme支持

  • 相关阅读:
    for是个什么玩意
    面向对象 多态
    面向对象 接口
    面向对象oop
    面向对象基本
    java修饰符的作用范围
    static 关键字介绍
    JsonLayout log4j2 json格式输出日志
    多线程--Thread.join方法
    idea常用实用快捷键
  • 原文地址:https://www.cnblogs.com/lurenjiashuo/p/15948608.html
Copyright © 2020-2023  润新知