I would like to allow my iPhone App users to view and select from their facebook profile photos, download the photo to use as a profile pic. I am currently using the Facebo
Download the FBGraph Api documents folder then add it to in your folder. and read the instruction on facebook developer site http://developers.facebook.com/docs/reference/api/.
This is the sample code - sample code
In this you will get a user profile pic in UIAlertView
. You can show it where you want.
For the sake of future viewers, I'm putting the answer to my own question since I haven't received a complete answer from anyone else.
First, you must have the right permissions, either "user_photos"
or "friends_photos"
. Then you have to make sure that your test device updates your permissions -- I think restarting the device is what ultimately did it for me.
Once you've done that, you can get the JSON list of albums, after logging in via SSO, using this call:
[facebook requestWithGraphPath:@"me/albums" andDelegate:self];
This will give JSON array (under key data
) with all kinds of information about each album, including the ID. To get a list of photos for a particular album ID (say its '123456789') do the following:
NSString * albumId = @"123456789";
NSString * path = [NSString stringWithFormat:@"%@/photos", albumId];
[facebook requestWithGraphPath:path andDelegate:self];
Your response will of course come via the FBRequestDelegate
method request:didLoad
where you can process the JSON data.