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

 

 

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

 

在你的应用中,调用api可以直接打开这些作为前缀的一些URL(注意:URL的本意<统一资源定位>,不仅仅是网址)

而且这些Schema都是Apple-registered ,也就是苹果内置注册的Schema,比方你在你的应用程序中OpenURL  http://www.baidu.com

那么就会自动调用safari浏览器打开这个网址,同样使用 zhangsan@126.com 会打开邮件程序发送邮件。。。。这些都是苹果已经做好的,

好了,那么这个Schema是不是可以个性化呢,也就是custom呢,答案是肯定的,比方:

制作了a应用,想在别人<别的应用程序>openurl:@“myapp://”时自动打开你的a应用,那么这个是可以实现的,也就是注册自己的Schema给系统,系统到时候接收到别人openurl你的schema时就会调用你的应用。

下面详细图文说明如何实现

ios 开发中 注册并使用个性化URL Schema_移动开发

ios 开发中 注册并使用个性化URL Schema_应用程序_02

ios 开发中 注册并使用个性化URL Schema_Universal_03




ios 开发中 注册并使用个性化URL Schema_移动开发_04

ios 开发中 注册并使用个性化URL Schema_移动开发_05

ios 开发中 注册并使用个性化URL Schema_移动开发_06

 

Now that the URL has been registered. Anyone can start the application by opening a URL using your scheme.


Here are a few examples …
myapp://

myapp://some/path/here

myapp://?foo=1&bar=2

myapp://some/path/here?foo=1&bar=2
The iPhone SDK, when launching the application in response to any of the URLs above, will send a message to the UIApplicationDelegate.