objective c - Facebook iOS SDK - fetching user albums -


i using facebook sdk in iphone app. want find user's facebook profile photos, using below code:

-(ibaction)facebooklogin:(id)sender{     if (fbsession.activesession.isopen) {          [self findalbums];     } else {         nsarray *permissions = [[nsarray alloc] initwithobjects:@"user_photos",                                 nil];          [fbsession openactivesessionwithpermissions:permissions                                        allowloginui:yes                                   completionhandler:^(fbsession *session,                                                       fbsessionstate status,                                                       nserror *error) {                                       // if login fails reason, alert                                       if (error) {                                         } else if (fb_issessionopenwithstate(status)) {                                            [[fbrequest requestforme] startwithcompletionhandler:                                            ^(fbrequestconnection *connection, nsdictionary<fbgraphuser> *user, nserror *error) {                                                if (!error) {                                                    [self findalbums];                                                 }                                            }];                                       }                                   }];     } }  -(void)findalbums {     [fbrequestconnection startwithgraphpath:@"/me/albums"                                  parameters:nil                                  httpmethod:@"get"                           completionhandler:^(                                               fbrequestconnection *connection,                                               id result,                                               nserror *error                                               ) {                               /* handle result */                               nslog(@"result::%@",result);                           }];  } 

out put ---- data = ( );

this not give albums in data. facebook user logged in have many albums , photos in profile. why happens?

just change code in find albums :

        [fbrequestconnection startwithgraphpath:@"me/albums"                       completionhandler:^(fbrequestconnection *connection, id result, nserror *error) {                           if (!error) {                               // success! include code handle results here                               nslog(@"user events: %@", result);                               nsarray *feed =[result objectforkey:@"data"];                                (nsdictionary *dict in feed) {                                    nslog(@"first %@",dict);                                }                           } else {                               // error occurred, need handle error                               // check out our error handling guide: https://developers.facebook.com/docs/ios/errors/                               nslog(@"error %@", error.description);                           }  }]; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -