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

泄露秘密 提交于 2019-12-04 17:43:39

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

Alok SInha

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"]];

}

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