从其他本地iPhone应用程序调用本机iPhone应用程序的方法 [英] Ways to call a native iPhone application from another native iPhone application

查看:150
本文介绍了从其他本地iPhone应用程序调用本机iPhone应用程序的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从另一个原生iPhone应用程序调用原生iPhone应用程序的各种方法是什么?

What are the various ways to call a native iPhone application from another native iPhone application?

推荐答案

方案内置到iOS。例如,您可以使用网址调用Safari,因为它已注册为处理 http URL方案的应用程序

You can use the url scheme built into iOS. For example, you could call Safari with a url because it is registered as the application which handles the http URL scheme

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com/"]]

openURL:方法是单例UIApplication实例的实例方法,可以调用任何安装的应用程序它在其plist中注册了处理某种输入数据的能力。

The openURL: method is an instance method of the singleton UIApplication instance, on which you can call any application installed which registers in its plist an ability to handle some sort of input data.

以下是iOS中常见的网址方案列表。

一个用于检测设备上另一个应用程序是否存在的方法是使用 canOpenURL:在同一单例实例上:

A little known way to detect the existence of another application on a device is to use canOpenURL: on the same singleton instance:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://"]])
{
    NSLog(@"cydia installed");
}
else
{
    NSLog(@"cydia not installed");
}

这篇关于从其他本地iPhone应用程序调用本机iPhone应用程序的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆