iOS facebook sdk how to download album, profile photos data

前端 未结 2 1309
一向
一向 2021-01-03 02:59

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

相关标签:
2条回答
  • 2021-01-03 03:08

    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.

    0 讨论(0)
  • 2021-01-03 03:21

    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.

    0 讨论(0)
提交回复
热议问题