facebook-csharp-sdk / facebook-windows-phone-sample Goto Github PK
View Code? Open in Web Editor NEWWindows Phone 7 Sample using Facebook SDK for .NET
License: Apache License 2.0
Windows Phone 7 Sample using Facebook SDK for .NET
License: Apache License 2.0
If you hit the button "Login To Facebook" then the page with the facebook login UI loads.
Then when i hit the back button on my phone i get a black screen and a error message then when i hit back again i'm seeing the MainPage.xaml. Now the "Login To Facebook" button does not show the login UI but gives a direct error message.
I am following Your Instructions. It was working in my sample project. When i try to implement in my original project i get error.
private void LoginSucceded(string accessToken)
{
var fb = new FacebookClient(accessToken);
fb.GetCompleted += (o, e) =>
{
if (e.Error != null)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show(e.Error.Message);
return;
});
}
var result = (IDictionary<string, object>)e.GetResultData();
var id = (string)result["id"];
var url = string.Format("/Views/FacebookInfoPage.xaml?access_token={0}&id={1}", accessToken, id);
var rootFrame = (App.Current as App).RootFrame;
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
rootFrame.Navigate(new Uri(url, UriKind.Relative));
});
};
fb.GetAsync("me?fields=id");
}
In this method i am getting error in this line: fb.GetAsync("me?fields=id");
error..System.NotImplementedException: This property is not implemented by this class.
at System.Net.HttpWebRequest.SetUserAgent(String value)
at System.Net.HttpWebRequest.set_UserAgent(String value)
at Facebook.HttpWebRequestWrapper.set_UserAgent(String value)
at Facebook.HttpWebRequestWrapper.TrySetUserAgent(String userAgent)
at Facebook.FacebookClient.PrepareRequest(HttpMethod httpMethod, String path, Object parameters,
Type resultType, Stream& input, Boolean& containsEtag, IList`1& batchEtags)
at Facebook.FacebookClient.ApiAsync(HttpMethod httpMethod, String path, Object parameters, Type resultType, Object userState)
at Facebook.FacebookClient.GetAsync(String path, Object parameters, Object userState)
at Facebook.FacebookClient.GetAsync(String path)
at TestReactive.com.beno.WP7Client.ViewModels.FacebookViewModel.LoginSucceded(String accessToken)
at TestReactive.com.beno.WP7Client.ViewModels.FacebookViewModel.webBrowser_Navigated(Object sender, NavigationEvPID:0ED1004E TID:0F8A0042 entArgs e)
at Microsoft.Phone.Controls.WebBrowser.FireNavigatedEvent(Uri uri)
at Microsoft.Phone.Controls.WebBrowserInterop.ReversePInvokeThunk.OnNavigated(Int32 webBrowserControlId, String uri)
Please help me to resolve this problem.
I am working through the samples for login on the facebooksdk.net site and have the sample for login working for a Windows store app working as expected.
I cannot get the sample for a Windows Phone app to work properly, however. When I follow the sample, I have to first modify the XAML namespace sample from: xmlns:facebookControls="clr-namespace:Facebook.Client.Controls;assembly=Facebook.Client" to xmlns:facebookControls="using:Facebook.Client.Controls". This is the same as it is for the Windows Store application and prevents a compilation error in VS 2013 from occurring. Even after doing this, I do NOT see the login button appear in the designer as I do for the Windows app. At runtime the button does appear in the emulator or on a device. When clicking the Facebook login button a “Not Implemented Exception” is thrown from deep in the stack which appears to be coming from Facebook.Client.FacebookSessionClient as can be seen in this stack trace:
at Windows.Security.Authentication.Web.WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions options, Uri requestUri, Uri callbackUri)
at Facebook.Client.FacebookSessionClient.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Facebook.Client.FacebookSessionClient.<LoginAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at Facebook.Client.FacebookSessionClient.d__e.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Facebook.Client.Controls.LoginButton.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Facebook.Client.Controls.LoginButton.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__3(Object state)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()
I am wondering if this is something that is known and if there is a work around for this issue? Here are the versions of the NuGet packages that I am currently using:
Facebook: 6.0.10.0
Facebook.Client: 0.9.1.0
Visual Studio 2013 R3 with .NET 4.5.1
Facebook Login Page is not showing
Getting Internal Server Error 500 on FacebookLoginPage.xaml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.