在iPhone应用程序中显示Facebook企业页面的Facebook新闻源 [英] Display Facebook News Feed in iPhone app for a Facebook Business Page

查看:110
本文介绍了在iPhone应用程序中显示Facebook企业页面的Facebook新闻源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

有一个公开可用的Facebook商业页面,我可以在Web浏览器中查看整个页面和Facebook新闻提要,而无需实际登录到我的Facebook帐户.因此,没有会话或身份验证信息可在我的浏览器中显示此网页.

我想要的是

现在,我想在本机iPhone应用程序中以滚动UITableView的形式显示此Facebook业务页面的Facebook新闻提要.我该怎么做?

问题:

当我访问Graph API资源管理器时( https://developers.facebook.com/tools/explorer ),我可以看到与Facebook业务页面(例如,百事可乐)相关的相册和照片,但是如果我尝试访问新闻源,例如...

我的问题:

如果百事可乐Facebook新闻订阅源可以在不通过Web浏览器登录我的Facebook帐户的情况下公开查看,那么如何在没有访问令牌的本地iPhone应用程序中显示百事可乐Facebook新闻订阅源?

谢谢

解决方案

引入令牌过期后,我遇到了同样的问题.但是后来出现了RSS提要的想法.

访问 https://developers.facebook.com/tools/explorer

用您的页面名称替换get字段中的ID.因此,获取字段链接应类似于:

https://graph.facebook.com/Pepsi

提交它,作为回报,您将在下面的显示中得到一堆json.您将需要第一个信息ID.百事可乐页面为56381779049.

现在将ID放在下面的链接中,以获取所需的供稿.

https://www.facebook.com/feeds/page.php?id={Id we just got}&format={json|rss20}

因此我们的json提要的百事可乐页面如下所示:

http://www.facebook.com/feeds/page.php?id=56381779049&format=json

现在,您只需要解析和查看任何地方即可.

您可以通过以下链接对Twitter feed进行类似操作:

http://api.twitter.com /1/statuses/user_timeline.json?screen_name=anontech&include_rts=0

rts用于转发.

更新:从设备获取数据时遇到了一些问题.经过微小的更改后,它就可以在Android和iOS上完美运行. 解决方法:在Facebook将响应标头作为application/json发送时,将accept标头更改为*/*或application/json.

header:'Accept:application/json';

来自以下位置的详细信息: cURL和Facebook问题

BACKGROUND:

There is a publicly available Facebook business page, I can see the entire page and the Facebook news feed in my web browser, without actually being logged into my Facebook account. So there is no session or authentication information to display this web page in my browser.

WHAT I WANT:

Now, I want to show the Facebook news feed for this Facebook business page as a scrolling UITableView within my native iPhone app. How do I do this?

THE PROBLEM:

When I access the Graph API explorer ( https://developers.facebook.com/tools/explorer ), I can see the albums and photos associated with a Facebook business page (ie. Pepsi), but if I try to access the news feed, like so... https://graph.facebook.com/Pepsi/feed ... it returns with an error stating "An access token is required to request this resource."

MY QUESTION:

If the Pepsi Facebook news feed is publicly viewable without being logged into my Facebook account from a web browser, then how do I show the Pepsi Facebook news feed in a native iPhone app without an access token?

Thanks

解决方案

I got into same issue after token expire introduced. But then came the idea of rss feed.

Visit https://developers.facebook.com/tools/explorer

Replace the ID in get field with your page name. So the get field link should look like:

https://graph.facebook.com/Pepsi

Submit it and in return you will get a bunch of json in the display below. You will need the very first info the id. which is 56381779049 for the Pepsi page.

Now place the id in the link below to get your desired feed.

https://www.facebook.com/feeds/page.php?id={Id we just got}&format={json|rss20}

So our Pepsi page for json feed would look like:

http://www.facebook.com/feeds/page.php?id=56381779049&format=json

Now you just have to parse and view anywhere.

You can do similar with twitter feed with link:

http://api.twitter.com/1/statuses/user_timeline.json?screen_name=anontech&include_rts=0

Where rts for retweets.

Update: Experienced some issue while fetching data from device. After this small change it worked perfectly on android as well as iOS. To solve: Change the accept header to */* or application/json as facebook is sending the response header as application/json.

header: 'Accept: application/json';

Detailed info from: cURL and Facebook problems

这篇关于在iPhone应用程序中显示Facebook企业页面的Facebook新闻源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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