码迷,mamicode.com
首页 > 移动开发 > 详细

IOS -- 利用URL Scheme启动第三方应用

时间:2015-04-11 13:19:39      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:

启动Instagram为例


Custom URL Scheme

Opening instagram://, followed by one of the following parameters, will open our app and perform a custom action. For example, for camera, you would direct users on the iPhone to the custom URL instagram://camera.

URL OPENS
app The Instagram app
camera The camera (or photo library on non-camera devices)
media?id=MEDIA_ID Media with this ID
user?username=USERNAME User with this username
location?id=LOCATION_ID Location feed for this location ID
tag?name=TAG Tag feed for this tag

The Objective-C call to open one of these URLs is as follows:

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    [[UIApplication sharedApplication] openURL:instagramURL];
}

//开启浏览器打开某网页
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://instagram.com/"]];</span>


https://instagram.com/developer/mobile-sharing/iphone-hooks/#

IOS -- 利用URL Scheme启动第三方应用

标签:

原文地址:http://blog.csdn.net/tanmengwen/article/details/44994125

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!