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

本文介绍了如何利用自定义URL Scheme在iOS中启动第三方应用,以Instagram为例,通过`instagram://camera`可以打开Instagram的相机功能。Objective-C中打开此类URL的方法也进行了说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

启动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>



That site is handleOpenUrl.com and you can search for specific applications or even for specific types of applications


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值