如何在iPhone应用程序中使用Facebook照片? [英] How to use Facebook Photos in an iPhone App?

查看:147
本文介绍了如何在iPhone应用程序中使用Facebook照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户想要在iPhone应用程序中使用他们的Facebook照片。我们希望将自己的帐户嵌入到应用中,以便当用户下载该应用时,他们会看到客户的Facebook照片。用户不需要登录或连接到Facebook。



这不同于标准连接到Facebook,所以我们可以访问你的数据 - 我们不需要访问用户数据。



我需要创建一个Facebook应用程序,将客户端的Facebook帐户连接到Facebook应用程序,然后使用它来获取照片数据?






好的,这是我发现的



我的商业页面是 http://www.facebook.com/pages/Feltpad-Web-Mobile/128861547181352



最后的数字( 128861547181352 )是商家的Facebook图形ID



然后使用业务图ID,然后转到 http://graph.facebook .com / 128861547181352 /专辑,您将看到与该商家页面相关联的所有相册的列表。只有一张专辑,所以这是你得到的所有信息。该页面上的第一个有价值的行说是id:133208113413362 - 这是该专辑的Facebook图形ID。



然后使用相册的图形ID,然后转到 http ://graph.facebook.com/133208113413362/photos - 这将给你一个JSON文件,其中包含所有相册中所有照片所需的数据。



您还可以使用?limit = 25 ?offset = 50 ?limit = 25& offset = 50 以浏览结果。

解决方案

这应该很简单。 Facebook为公开的相册提供公开的URL,无需登录。您可以在相册页面的底部看到您可能想要分享的URL。



它看起来像这样:


与任何人分享这张专辑给他们这个公开链接:

http://www.facebook.com/album.php?aid= [ALBUM_ID]& id = [USER_ID]& l = [SOME_PARAM]


(从公开相册引用)



您可以轻松地从数据中提取数据并从中提取图像。 / p>




然而,创建一个Facebook应用程序(需要一点时间)更加理智,并使用Facebook图形API来制作REST调用以在格式良好的JSON中检索有关其中的专辑和照片的所有数据,这将更容易处理HTML。一旦你有Facebook应用程序到位,你可以使用它来获取所有的FB数据,但它违反了你的两个要求(1)不使用Facebook应用程序,和(2)用户不必登录。



但是可能值得一看








嗯,有一些技巧。如果您访问API页面(http://developers.facebook.com/docs/api)。复制可口可乐相册(https://graph.facebook.com/99394368305)所提供的URL,并发出照片的请求,如 https://graph.facebook.com/99394368305/photos ,您可以访问相册中所有照片的所有详细信息JSON格式。我无法让它为我的个人公共相册工作。


I have a client who wants to use their Facebook photos in an iPhone app. We want to embed their account into the app so that when people download the app, they see the client's Facebook photos. The user should not need to login or connect to 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.

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 ?


Ok, here is what I found

My business page is http://www.facebook.com/pages/Feltpad-Web-Mobile/128861547181352

That number at the end (128861547181352) is the business' "Facebook Graph 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. 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.

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.

You can also use ?limit=25 and ?offset=50 or both ?limit=25&offset=50 to page through the results.

解决方案

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.

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]

(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. 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.

But it may worth looking at


Well, there is some trick. If you go to the API page(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. I could not get it work for my personal public album though.

这篇关于如何在iPhone应用程序中使用Facebook照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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