Login and Logout is working correctly. According to Facebook
"Your app can get notifications of login results or logout events. To do this assign a delegate to FBSDKLoginButton that confirms to FBSDKLoginButtonDelegate protocol."
I've added the FBSDKLoginButtonDelegate to my view controller which has the following property:
@property (weak, nonatomic) IBOutlet FBSDKLoginButton *FacebookButton;
and the .m (implementation) file has:
@interface firstVC ()
<FBSDKLoginButtonDelegate>
@end
but the problem is that the FBSDKLoginButtonDelegate is not calling:
- (void) loginButton: (FBSDKLoginButton *)loginButton
didCompleteWithResult: (FBSDKLoginManagerLoginResult *)result
error: (NSError *)error{
NSLog(@"facebook login button test");
}
and on logout is not calling:
- (void) loginButtonDidLogOut:(FBSDKLoginButton *)loginButton{
NSLog(@"facebook logout button test");
}
Additionally I have declared the aforementioned methods in the header between @interface and @end
I had to make sure the button's class was FBSDKLoginButton instead of UIButton, which I had already done:
@property (weak, nonatomic) IBOutlet FBSDKLoginButton *FacebookButton;
Once I did that and implemented the two aforementioned classes in the question, then the fix was to set the button delegate to self on viewDidLoad in the implementation file:
[FacebookButton setDelegate:self];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With