c# - Windows Phone 8.1 Live SDK 5.6 Login issue -
i following windows live sdk 5.6 example codes , have own simple app trying login onedrive. microsoft account given step step, seems fine, however, system.nullreferenceexception, when application goes page again, when click single button:
private async void signinbtn_click(object sender, routedeventargs e) { try { authclient = new liveauthclient(); system.diagnostics.debug.writeline("authclient = " + authclient); loginresult = await authclient.loginasync(new string[] { "wl.signin", "wl.skydrive", "wl.skydrive_update", "wl.photos" }); if (loginresult.status == liveconnectsessionstatus.connected) { liveclient = new liveconnectclient(loginresult.session); var meresult = await liveclient.getasync("me"); system.diagnostics.debug.writeline(meresult.result["name"].tostring() + ", " + "you have logged in onedrive!"); } } catch (liveauthexception authexp) { system.diagnostics.debug.writeline("liveauthexception = " + authexp.tostring()); } catch (liveconnectexception connexp) { system.diagnostics.debug.writeline("liveconnectexception = " + connexp.tostring()); } } it throws exception @ line:
loginresult = await authclient.loginasync(new string[] { "wl.signin", "wl.skydrive", "wl.skydrive_update", "wl.photos" }); anything goes wrong in codes? referred sample codes?
try passing list instead of string array:
public static async task<liveloginresult> loginasync() { list<string> onedrivescopes = new list<string>() { "wl.signin", "wl.basic", "wl.skydrive_update" }; liveauthclient authclient = new liveauthclient(); liveloginresult authresult; try { authresult = await authclient.loginasync(onedrivescopes); } catch { return null; } return authresult; }
Comments
Post a Comment