我開發了Windows Phone 8應用程序訪問天空drive.i我收到以下錯誤,當我打電話LoginAsync()方法 - 類型的異常「Microsoft.Live.LiveAuthException」發生在mscorlib.ni.dll但在用戶代碼中沒有處理我WP8應用開發的天空驅動器時收到錯誤在LoginAsync方法
using System;
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Live;
namespace SkyDriveApp
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
LiveConnectClient client;
public MainPage()
{
InitializeComponent();
}
public async void Auth()
{
string clientId = "My_client_id";
LiveAuthClient auth = new LiveAuthClient(clientId);
// var result = await auth.InitializeAsync(new[] { "wl.basic", "wl.signin", "wl.skydrive_update" });
var result = await auth.LoginAsync(new[] { "wl.basic", "wl.signin", "wl.skydrive_update" });
if (result.Status == LiveConnectSessionStatus.Connected)
{
client = new LiveConnectClient(result.Session);
tbMessage.Text = "Connected!";
}
}
private void btnLogin_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
{
Auth();
}
}
}
你使用來自https://account.live.com/developers/applications/index正確的客戶端ID?你的應用程序應該設置爲移動客戶端應用程序,你這樣做? –
@igrali是的,我做了它,我有客戶端ID。 –
您是否在清單中啓用了ID_CAP_WEBBROWSERCOMPONENT? –