在iOS上打开Facebook应用程式的Facebook连结

编程入门 行业动态 更新时间:2024-10-13 14:28:42
本文介绍了在iOS上打开Facebook应用程式的Facebook连结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

www.facebook/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/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:

www.facebook/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

wiki.akosma/IPhone_URL_Schemes#Facebook

更多推荐

在iOS上打开Facebook应用程式的Facebook连结

本文发布于:2023-11-27 23:23:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640016.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程式   iOS   Facebook

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!