Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get photos of a facebook album in iPhone SDK?

I am developing a iPhone application which get facebook album with this URL https://graph.facebook.com/me/albums?access_token=2227470867|2.ZJr73vaEvFeN4fI_A70RFw__.3600.1297090800-100000566543036|WmgxdwULBgKXl8J7ksGIA1tyGik

Now i want to get photos from this album.

Any Idea will be appreciated.

Thanks in Advance.

like image 273
Apekshit Avatar asked Feb 07 '11 13:02

Apekshit


People also ask

How do I get pictures from Facebook to my iPhone app?

Tap. in the bottom right of Facebook, then tap your name. Tap Photos, then tap Albums at the top. Tap the album you'd like to view.

How do I find album ID on Facebook?

Facebook Single Photo Gallery ID To get the gallery ID simply go to your albums on facebook. Then click on your favorite album. Next you will need to copy the numbers in the url like this.


2 Answers

So /me/albums returns an array of Album objects, each of which has an id.

If an album had an id of 99394368305, you can go to

https://graph.facebook.com/99394368305/photos

to get an array of photo objects.

Each of these will have the picture and source properties to get the image data from facebook.

They will all have an images array as well if you want pre-scaled images instead of just the originals.


All the facebook queries give JSON back - I'm assuming that you know how to parse this?

like image 164
deanWombourne Avatar answered Sep 20 '22 14:09

deanWombourne


It takes lot of time because of following steps;

1) get uid of friend using :

NSString *urlString=[NSString stringWithFormat:@"https://graph.facebook.com/me/friends?access_token=%@&fields=id,picture,name,birthday",fbGraph.accessToken];

2) put friends uid to get album id:

NSString *urlString1=[NSString stringWithFormat:@"https://graph.facebook.com/%@/albums?access_token=%@",obj.uid,fbGraph.accessToken];

NSString *album = [[[_response1 objectForKey:@"data"]objectAtIndex:j]objectForKey:@"name"];

if ([album isEqualToString:@"Profile Pictures"]) 
{
      albumid = [[[_response1 objectForKey:@"data"]objectAtIndex:j]objectForKey:@"id"];
}

3) then put the album id to get the picture from that album:

NSString *albumUrl=[NSString stringWithFormat:@"https://graph.facebook.com/%@/photos?type=album&access_token=%@",albumid,fbGraph.accessToken];

 NSString *picUrl=[[[[[_response2 objectForKey:@"data"]objectAtIndex:0]objectForKey:@"images"]objectAtIndex:0]objectForKey:@"source"];

Kindly tell me some other method to get profile picture with large size in a single step to save time.

like image 45
Engr Irfan Ali Avatar answered Sep 18 '22 14:09

Engr Irfan Ali