I am trying to implement login by facebook in a xamarin ios application, Following an example from monotouch-bindings I am checking if the user is logged in AppDelegate using this:
var sessionDelegate = new SessionDelegate (this);
facebook = new Facebook (AppId, sessionDelegate);
if (facebook.IsSessionValid) {
ShowLoggedIn ();
}
else
{
ShowLoggedOut ();
}
The problem is that when the user is not logged in, I am navigating to another viewController in order for him to login. When he tries to Login the Facebook App opens, but after the login I am not getting the callback. If I do the whole flow in AppDelegate, then the callback works. I have noticed that in AppDelegate there are 2 overrides implemented:
public override bool HandleOpenURL
and
public override bool OpenUrl
They both return return facebook.HandleOpenURL (url);
facebook is declared in the AppDelegate but also in the login viewController, so I guess this is part of the problem.
I am new to iOS and mono touch, so i hope this make sense.
Any ideas how to solve it? or maybe an example where Facebook login is not performed from the AppDelegate?
Thanks!