在iOS上打开Facebook应用程式的Facebook连结 [英] Open a facebook link by native Facebook app on iOS

查看:213
本文介绍了在iOS上打开Facebook应用程式的Facebook连结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果iPhone上安装了本地的Facebook应用程序。如何从我的应用程序打开Facebook的本地应用程序的Facebook链接。在Safari开放的情况下,链接与以下相同:


http://www.facebook.com/AlibabaUS


谢谢。

解决方案

这是Facebook应用程序使用的一些方案,源链接上有更多的一些方案:



示例



  NSURL * url = [NSURL URLWithString:@fb:// profile / < ID>中]; 
[[UIApplication sharedApplication] openURL:url];



方案




fb://个人资料 - 将Facebook应用程序打开到用户的个人资料



fb://朋友 - 打开Facebook应用程序到朋友列表



fb://通知 - 打开Facebook应用程序到通知列表(注意:这个URL似乎有一个错误,通知页面打开,但是不可能导航到在Facebook应用程序中的其他任何地方)



fb:// feed - 将Facebook应用程序打开到新闻Feed



fb:// events - 打开Facebook应用程序到活动页面



fb://请求 - 将Facebook应用程序打开到请求列表



fb:// notes - 打开Facebook应用程序到Notes页面



fb:// albums - 打开Facebook应用程序到相册列表


如果在打开此网址之前,您想检查用户的脸书应用程序,您可以执行以下操作(如解释如果([[UIApplication sharedApplication] canOpenURL:nsurl]){
[[...] UIApplication sharedApplication] openURL:nsurl];
}
else {
//像往常一样打开url
}



来源



http:/ /wiki.akosma.com/IPhone_URL_Schemes#Facebook


If the native Facebook app is installed on the iPhone. How do I open a facebook link into the native Facebook app from my app. In the case of opening by Safari, the link is same as:

http://www.facebook.com/AlibabaUS

Thank you.

解决方案

Here are some schemes the Facebook app uses, there are a ton more on the source link:

Example

NSURL *url = [NSURL URLWithString:@"fb://profile/<id>"];
[[UIApplication sharedApplication] openURL:url];

Schemes

fb://profile – Open Facebook app to the user’s profile

fb://friends – Open Facebook app to the friends list

fb://notifications – Open Facebook app to the notifications list (NOTE: there appears to be a bug with this URL. The Notifications page opens. However, it’s not possible to navigate to anywhere else in the Facebook app)

fb://feed – Open Facebook app to the News Feed

fb://events – Open Facebook app to the Events page

fb://requests – Open Facebook app to the Requests list

fb://notes – Open Facebook app to the Notes page

fb://albums – Open Facebook app to Photo Albums list

If before opening this url you want to check wether the user fas the facebook app you can do the following (as explained in another answer below):

if ([[UIApplication sharedApplication] canOpenURL:nsurl]){
    [[UIApplication sharedApplication] openURL:nsurl];
}
else {
    //Open the url as usual
}

Source

http://wiki.akosma.com/IPhone_URL_Schemes#Facebook

这篇关于在iOS上打开Facebook应用程式的Facebook连结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆