脸书登录未实现异常错误
本文关键字:异常 错误 实现 登录 | 更新日期: 2023-09-27 18:33:06
im 使Facebook登录到我的窗口手机8.1 . 当单击登录按钮时,它会破坏应用程序年龄我这个
类型为"System.NotImplementException"的异常发生在 mypriject.exe但没有在用户代码中处理
其他信息:未实现
如果存在此异常的处理程序,则程序可能是安全的 继续。
然后带我去这个app.g.i.cs 页面并突出显示此行
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
**这是我的代码请帮助我**
public sealed partial class BlankPage1 : Page
{
FacebookClient fb = new FacebookClient();
string AccessToken = null;
public BlankPage1()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.
/// This parameter is typically used to configure the page.</param>
private async void Button_Click(object sender, RoutedEventArgs e)
{
string redirect_url="https://www.facebook.com/connect/login_seccess.html";
var loginURL = fb.GetLoginUrl(new{
client_id ="**myapp id here**",
redirect_uri = redirect_url,
response_type ="token",
scope ="email,publish_stream,user_groups"
});
var res= await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None,loginURL,new Uri(redirect_url) );
if(res.ResponseStatus==WebAuthenticationStatus.Success)
{
var callback = new Uri(res.ResponseData.ToString());
var token = fb.ParseOAuthCallbackUrl(callback);
AccessToken = token.AccessToken;
await new MessageDialog("AccessToken").ShowAsync();
}
}
}
在 Windows Phone 8.1 AuthenticateAsync 中不起作用使用这个
WebAuthenticationBroker.AuthenticateAndContinue(loginURL ,null WebAuthenticationOptions.None);