FBConnect iphone : I coud'nt get Photos albums for some account ?

给你一囗甜甜゛ 提交于 2020-01-13 05:48:10

问题


Maybe someone can't help me.

I use the last FBConnect (http://github.com/facebook/facebook-ios-sdk/) for Facebook connexion. And I retreive the list of photos albums for the user.

NSMutableDictionary* params = [NSMutableDictionary NictionaryWithObjectsAndKeys:_facebook.accessToken,@"access_token",nil];
[_facebook requestWithGraphPath:@"me/albums" andParams:params andDelegate:self];

I'm testing with 4 differents account with all the same rules for privacy (Account/Privacy settings). And for some of them the albums list is empty ? And if i test via a webbrowser on a desktop computer (https://graph.facebook.com/me/albums) for account who doesn't work on iphone, the list is not empty ?

On iphone, i use graph api or FQL with same results ("SELECT aid FROM album WHERE owner = me()")

Maybe i miss some think about configuration off the facebookapp ?

Thanks for answer.


回答1:


I resolve the solution with good settings for facebook authentifications http://developers.facebook.com/docs/authentication/permissions




回答2:


THIS WILL PUT ALL THE IMAGES OF THE ALBUM IN SOURCE ARRAY!

NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/photos&access_token=AAACeFkezepQBANpoFq9I3Hts0JdE6Xis3UpZBqNxpgw62zWSlhSYyYcluGaaxH3IlKIh9w8OYrXYF9MsAxhk6ta1ANZClCaznpdSaERgZDZD",A_ID]];
    URLWithString:@"https://graph.facebook.com/114750591966408/photos&access_token=//AAACeFkezepQBANpoFq9I3Hts0JdE6Xis3UyYcluGaaxH3IlKIh9w8OYrXYF9MsAxhk6ta1ANZClCaznpdSaERgZDZD"];
    NSData *data1 = [NSData dataWithContentsOfURL:url1];
    NSString *str1=[[NSString alloc] initWithData:data1 encoding:NSASCIIStringEncoding];
    // NSString *str1=[[NSString alloc]ini]
    NSDictionary *userData1 = [str1 JSONValue];
    NSArray *arrOfimages=[userData1 objectForKey:@"data"];
    NSMutableArray *sourceUrls = [[NSMutableArray alloc] initWithCapacity:0];

for(NSDictionary *subDictionary in arrOfimages) 
{

 [sourceUrls addObject:[subDictionary objectForKey:@"picture"]];

}



回答3:


publish_actions and user_photos permissions is required.

And then please try the following code :

[FBRequestConnection startWithGraphPath:@"me/albums"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                          if (!error) {
                              // Success! Include your code to handle the results here
                              NSLog(@"user events: %@", result);
                              NSArray *feed =[result objectForKey:@"data"];

                              for (NSDictionary *dict in feed) {

                                  NSLog(@"first %@",dict);

                              }
                          } else {
                              // An error occurred, we need to handle the error
                              // Check out our error handling guide: https://developers.facebook.com/docs/ios/errors/
                              NSLog(@"error %@", error.description);
                          }
 }];


来源:https://stackoverflow.com/questions/3717620/fbconnect-iphone-i-coudnt-get-photos-albums-for-some-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!