ios开发 调用系统的facetime

来源:互联网 发布:linux wine 编辑:程序博客网 时间:2024/05/16 19:05

openURL:

Opens the resource at the specified URL.

- (BOOL)openURL:(NSURL *)url
Parameters
url

An object representing a URL (Universal Resource Locator). UIKit supports the http:, https:, tel:, and mailto: schemes.

Return Value

YES if the resource located by the URL was successfully opened; otherwise NO.

Discussion

The URL can locate a resource in the same or other application. If the resource is another application, invoking this method may cause the calling application to quit so the other one can be launched.

You may call canOpenURL: before calling this one to verify that there is an application that can handle it.

Availability
  • Available in iOS 2.0 and later.
See Also
  • application:handleOpenURL: (UIApplicationDelegate)
Related Sample Code
  • BonjourWeb
  • GeocoderDemo
  • LaunchMe
  • MailComposer
  • SeismicXML
Declared In
UIApplication.h



公司有一款IM产品,ios平台上想增加voip功能,所以早早的发了个外包,估计不少money,到现在4个月了,还没集成上来。

有一天看到一个类似的产品居然有voip(可视)功能,不是小看它的实力,要是它自己做,肯定一时半会做不出来,而且那界面跟系统的facetime很像,所以断定是调用了系统的facetime,特地研究了下,终于搞明白了,很简单的一一句话就调出了facetime功能。

 

NSURL* url = [NSURLURLWithString:@"facetime://xxxx"];//xxx就是对方设备上绑定的facetime帐号,可以是纯数字,或者数字加字符

[[UIApplication sharedApplication] openURL:url];


当然类似调用系统功能的schema还有不少 tel://xxx,mailto://xxx,SMS://xxx,http://xxx,https://xxx等等吧,facetime这个在sdk中没有查到,不知到是不是属于私有的,但是那款产品居然通过了appstore,应该是可以用的。



调用下面的代码来进行facetime的呼叫。呼叫后会进入到facetime的功能里面。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"facetime://xxx"]];

xxx可以是对方的email,也可以是对方的电话号码。

facetime的功能应该是私有api。所以代码中是不能对他进行各种操作的