I have spent several hours. Read up everything relevant I could find on the web, but haven't been able to resolve this. I am using FBLoginView per instructions provided in https://developers.facebook.com/docs/ios/login-ui-control/
I can see FBLogin button. I click on it. It logs me in. I see callbacks loginViewShowingLoggedInUser and loginViewShowingLoggedOutUser getting called. The problem is loginViewFetchedUserInfo not getting called. So, I am unable to get any information about the user (such as name, userID, email etc).
Here is the code I am using:
CGRect loginFrame=CGRectMake(MARGIN,currentFrame.size.height-LOGINBUTTONHEIGHT,50 , 20);//width, height don't matter
FBLoginView * FBLoginView1 = [[FBLoginView alloc] init];
FBLoginView1.readPermissions = @[@"email",
@"basic_info",
@"user_location",
@"user_birthday",
@"user_likes"];
FBLoginView1.frame = loginFrame;
FBLoginView1.delegate = self;
[[self view] addSubview:FBLoginView1];
[FBLoginView1 sizeToFit];
I found the solution. Actually, loginViewFetchedUserInfo is called after loginViewShowingLoggedInUser. I was not getting loginViewFetchedUserInfo because I was dismissing modalviewcontroller from loginViewShowingLoggedInUser. So, it was not around to get loginViewFetchedUserInfo. If I don't dismiss the modalviewcontroller, I get loginViewFetchedUserInfo.
Here are the details of the solution. I am creating FBLoginView in ViewDidLoad of a LoginViewcontroller (name of the class I implemented). I set the delegate when I create FBLoginView (inside ViewDidLoad function) LoginViewController is presented using presentViewController function. The problem was happening because I was dismissing the view controller in loginViewShowingLoggedInUser. So it was not around to receive loginViewFetchedUserInfo ( loginViewFetchedUserInfo is called after loginViewShowingLoggedInUser).
The solution that worked for me is to dismiss LoginViewcontroller from loginViewFetchedUserInfo.
Hope the details helps others.