zoukankan      html  css  js  c++  java
  • 如何在一个应用程序中调用另一个应用程序

    分两步:

    步骤一:
    首先在程序A的plist中添加url types
    <key>CFBundleURLTypes</key>
    <array>
    <dict>
    <key>CFBundleURLName</key>
    <string>AAAAA</string>
    <key>CFBundleURLSchemes</key>
    <array>
    <string>testA</string>
    </array>
    </dict>
    </array>

    步骤二:
    在程序B中调用A程序的地方添加代码
    // @"testA:" --> URLScheme
    NSURL *myURL_APP_A = [NSURL URLWithString:@"testA://AAAAA"];
    if ([[UIApplication sharedApplication] canOpenURL:myURL_APP_A]) {
        NSLog(@"canOpenURL");
        [[UIApplication sharedApplication] openURL:myURL_APP_A];
    }

    注:
    这里通过canOpenURL就可以通过URL检查机器是否安装有程序A
    通过openURL打开程序A
  • 相关阅读:
    JavaScript丨数组元素反转
    Executor框架浅析
    索引相关
    关系型数据库
    Cookie和Session
    HTTP和HTTPS
    TCP,UDP,HTTP
    OSI模型
    剑指Offer19
    剑指Offer03
  • 原文地址:https://www.cnblogs.com/q403154749/p/3928107.html
Copyright © 2011-2022 走看看