I am having problems using facebook binding from here ( https://github.com/mono/monotouch-bindings/tree/master/facebook ) and the problem is that the authorization (login) function doesnโt work on the device. It works fine on the simulator, but the official facebook application (installed on the phone) is launched from the device instead of the login window to the webbrowser.
The same thing happens with a reference sample.
Any ideas how I can use a browser to log into the system (if I do not delete the official facebook application, it works fine on the device as well) instead of the facebook application?
The code I'm using is:
class SessionDelegate : FBSessionDelegate { AppDelegate container; NSAction onLogin; public NSAction OnLogin { get { return this.onLogin; } set { onLogin = value; } } public SessionDelegate (AppDelegate container) { this.container = container; } public override void DidNotLogin (bool cancelled) { Console.WriteLine("did not login");
and
var sessionDelegate = new SessionDelegate (this); facebook = new Facebook (LocalSettings.FacebookAppId, sessionDelegate); var defaults = NSUserDefaults.StandardUserDefaults; if (defaults ["FBAccessTokenKey"] != null && defaults ["FBExpirationDateKey"] != null) { facebook.AccessToken = defaults ["FBAccessTokenKey"] as NSString; facebook.ExpirationDate = defaults ["FBExpirationDateKey"] as NSDate; }
and to enter:
facebook.Authorize(new string [] { "email", "publish_stream", "read_friendlists", "user_photos" });
source share