[英]Open Facebook application from my app
有人可以告诉URL方案从我的应用程序打开Facebook应用程序吗?
Use fb://
. 使用
fb://
。
canOpenURL
returns a BOOL
value indicating whether or not the URL's scheme can be handled by some app installed on the device. canOpenURL
返回一个BOOL
值,指示URL的方案是否可以由设备上安装的某个应用程序处理。 If canOpenURL
returns YES
then the application is present on the device. 如果
canOpenURL
返回YES
则应用程序出现在设备上。 If the user has Facebook installed on their device we open it. 如果用户在其设备上安装了Facebook,我们将其打开。 If the user does not have Facebook installed we open the page through a link, which will launch Safari.
如果用户没有安装Facebook,我们通过链接打开页面,这将启动Safari。
// Check if FB app installed on device
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile/355356557838717"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/DanielStormApps"]];
}
Check out iPhone URL Schemes for a list of what else you can achieve via URL Schemes. 查看iPhone URL Schemes ,了解您可以通过URL Schemes实现的其他功能。
Also, starting at iOS 9 you must include LSApplicationQueriesSchemes
in your info.plist
. 此外,从iOS 9开始,您必须在
info.plist
包含LSApplicationQueriesSchemes
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.