我添加了Facebook.dll和Facebook.Client.dll,此代码在Windows Phone和Windows 8.1应用程序上运行良好,但在用XAML和C#编码的Windows 10应用程序上不起作用。有人也有这个问题吗?
public async Task<string> LogIntoFacebook()
{
//var session = new Session();
Session FacebookSessionClient = new Session(Constants.FacebookAppId);
try
{
FacebookSessionClient.LoginWithBehavior(_FacebookPermissions, FacebookLoginBehavior.LoginBehaviorAppwithMobileInternetFallback);
await Session.CheckAndExtendTokenIfNeeded();
}
catch (FacebookOAuthException exception)
{
SimpleIoc.Default.GetInstance<IErrorService>().ReportErrorInternalOnly(exception);
return null;
}
catch (InvalidOperationException ex)
{
SimpleIoc.Default.GetInstance<IErrorService>().ReportErrorInternalOnly(ex);
return null;
}
catch (Exception ex)
{
SimpleIoc.Default.GetInstance<IErrorService>().ReportErrorInternalOnly(ex);
return null;
}
return null;
}
这部分"等待会话.CheckAndExtendedTokenIfNeedd();"应该是登录发生但什么也没发生的地方。
这里有一个链接:http://blogs.windows.com/buildingapps/2015/07/14/windows-sdk-for-facebook/
你可以为Facebook找到一个新的Windows SDK,它已经登录了
附言:你也可以看看这里:https://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-facebook-authentication/