简体   繁体   English

如何在iPhone应用程序中使用Facebook Photos?

[英]How to use Facebook Photos in an iPhone App?

I have a client who wants to use their Facebook photos in an iPhone app. 我有一个客户想要在iPhone应用程序中使用其Facebook照片。 We want to embed their account into the app so that when people download the app, they see the client's Facebook photos. 我们希望将他们的帐户嵌入到应用程序中,以便人们下载应用程序时可以看到客户的Facebook照片。 The user should not need to login or connect to Facebook. 用户不需要登录或连接到Facebook。

This is different than the standard "connect to facebook so we can access you data" - we have no need to access the users data. 这与标准的“连接到Facebook,以便我们可以访问您的数据”不同-我们无需访问用户数据。

Do I need to create a Facebook App, connect the client's Facebook account to the Facebook app, then use that to get the photo data ? 我需要创建一个Facebook应用程序,将客户的Facebook帐户连接到Facebook应用程序,然后使用它来获取照片数据吗?


Ok, here is what I found 好,这是我发现的

My business page is http://www.facebook.com/pages/Feltpad-Web-Mobile/128861547181352 我的商家页面是http://www.facebook.com/pages/Feltpad-Web-Mobile/128861547181352

That number at the end ( 128861547181352 ) is the business' "Facebook Graph ID" 末尾的数字( 128861547181352 )是公司的“ Facebook图形ID”

Then use the Business Graph ID and go to http://graph.facebook.com/128861547181352/albums and you will see a list of all of the Photo Albums associated with the business' page. 然后使用业务图ID并转到http://graph.facebook.com/128861547181352/albums ,您将看到与业务页面关联的所有相册的列表。 There is only one album, so that is all the info you get. 只有一张专辑,这就是您所获得的全部信息。 The first valuable line on that page says "id": "133208113413362" - this is the Facebook Graph ID for the album. 该页面上的第一行是"id": "133208113413362" -这是相册的Facebook图形ID。

Then use the Album's Graph ID and go to http://graph.facebook.com/133208113413362/photos - this will give you a JSON file with all the data you need for all the photos in the album. 然后使用相册的图ID并转到http://graph.facebook.com/133208113413362/photos-这将为您提供一个JSON文件,其中包含相册中所有照片所需的所有数据。

You can also use ?limit=25 and ?offset=50 or both ?limit=25&offset=50 to page through the results. 您还可以使用?limit=25?offset=50或同时使用?limit=25&offset=50翻页结果。

This should be easy. 这应该很容易。 Facebook gives a public URL for albums that are public to be viewed by the Internet without necessity of logging in. You can see this URL al the bottom of the album page that you may want to share. Facebook为公开的相册提供了一个公共URL,可以通过Internet 公开查看这些相册,而无需登录。您可以在想要共享的相册页面的底部看到此URL。

It looks like this: 看起来像这样:

Share this album with anyone by sending them this public link: 发送此公共链接,与任何人分享此相册:
http://www.facebook.com/album.php?aid=[ALBUM_ID]&id=[USER_ID]&l=[SOME_PARAM] http://www.facebook.com/album.php?aid=[ALBUM_ID]&id=[USER_ID]&l=[SOME_PARAM]

(quoted from a public album) (引自公开相册)

you can easily leach data and extract images from there. 您可以轻松地提取数据并从中提取图像。


However it is more sane to create a Facebook app (takes hardy a minute) and use Facebook graph-API to make REST calls to retrieve all the data about albums and photos within them in well formatted JSON that will be far easier to handle the HTML. 但是,创建一个Facebook应用程序(花费一分钟时间)并使用Facebook graph-API进行REST调用以格式化良好的JSON检索其中有关相册和照片的所有数据,这将更容易处理HTML,这更加理智。 。 Once you have Facebook App in place, you may use it to fetch all the FB data but it violates both of your requirements (1)Not using Facebook app, and (2) user don't have to sign-in. 安装好Facebook应用后,您可以使用它来获取所有FB数据,但是这违反了您的两个要求(1)不使用Facebook应用,以及(2)用户无需登录。

But it may worth looking at 但也许值得一看


Well, there is some trick. 好吧,有一些技巧。 If you go to the API page(http://developers.facebook.com/docs/api). 如果您转到API页面(http://developers.facebook.com/docs/api)。 Copy the URL given for Coca-Cola album (https://graph.facebook.com/99394368305) and make a request with photos REST command like https://graph.facebook.com/99394368305/photos you can access all the details of all the photos in the album in JSON format. 复制(https://graph.facebook.com/99394368305)为可口可乐专辑给出的网址,并与请求photos像REST命令https://graph.facebook.com/99394368305/photos您可以访问所有的细节相册中所有照片的JSON格式。 I could not get it work for my personal public album though. 不过,我无法将其用于我的个人公开相册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM