I am using Facebook SDK 3.14 (the latest), everything was working fine. Then yesterday, it stopped showing the Friends list of the logged in user.
Here's when I click on logIn
buttonL
- (IBAction)buttonClickHandler:(id)sender {
// get the app delegate so that we can access the session property
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
// this button's job is to flip-flop the session from open to closed
if (appDelegate.session.isOpen) {
// if a user logs out explicitly, we delete any cached token information, and next
// time they run the applicaiton they will be presented with log in UX again; most
// users will simply close the app or switch away, without logging out; this will
// cause the implicit cached-token login to occur on next launch of the application
[appDelegate.session closeAndClearTokenInformation];
} else {
if (appDelegate.session.state != FBSessionStateCreated) {
// Create a new, logged out session.
appDelegate.session = [[FBSession alloc] init];
}
// Attempt to open the session. If the session is not open, show the user the Facebook login UX
// if the session isn't open, let's open it now and present the login UX to the user
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// and here we make sure to update our UX according to the new session state
[self updateView];
}];
}
}
And in the updateView
method, I am calling the JSON of the Facebook graph request:
- (void)updateView {
// get the app delegate, so that we can reference the session property
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
if (appDelegate.session.isOpen) {
// valid account UI is shown whenever the session is open
selectedPageURL=[NSString stringWithFormat:@"https://graph.facebook.com/me/friends?access_token=%@&fields=name,id,picture,gender",
appDelegate.session.accessTokenData.accessToken];
[self load_HTTPRequest:selectedPageURL];
[FBSession setActiveSession:appDelegate.session];
FBRequest *me = [FBRequest requestForMe];
[me startWithCompletionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
NSDictionary<FBGraphUser> *my = (NSDictionary<FBGraphUser> *) result;
self.name.text = my.name;
[self.profile setImageWithURL:[NSURL URLWithString:[[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large", [my id]] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]];
}];
And in the AppDelegate, that's what I included:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:self.session];
}
These were doing good, but suddenly the friend list is empty (Empty Json), any advice?