以启动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/#
时间: 2024-10-27 06:54:29