저는 Windows 8 Store Application을 보유하고 있으며 Azure 인증을 추가하고 싶습니다. MSDN 페이지의 예제를 따라했습니다. 그러나, 다음 줄은 나에게 문제를주고있다 :Azure 모바일 서비스 인증 - App.MobileService가 존재하지 않습니다.
MobileServiceUser loginResult = await App.MobileService.LoginAsync(result.Session.AuthenticationToken);
오류는 다음과 같습니다 앱은 MobileService에 대한 정의가 포함되어 있지 않습니다. 언제 MobileService의 인스턴스가 App 클래스에 추가됩니까?
Microsoft.Live 및 Azure 모바일 서비스 라이브러리에 대한 참조가 추가되었습니다. 다음은 전체 Authenticate 함수입니다.
private async System.Threading.Tasks.Task Authenticate()
{
LiveAuthClient liveIdClient = new LiveAuthClient("<< INSERT REDIRECT DOMAIN HERE >>");
while (session == null)
{
// Force a logout to make it easier to test with multiple Microsoft Accounts
if (liveIdClient.CanLogout)
liveIdClient.Logout();
LiveLoginResult result = await liveIdClient.LoginAsync(new[] { "wl.basic" });
if (result.Status == LiveConnectSessionStatus.Connected)
{
session = result.Session;
LiveConnectClient client = new LiveConnectClient(result.Session);
LiveOperationResult meResult = await client.GetAsync("me");
MobileServiceUser loginResult = await App.MobileService.LoginAsync(result.Session.AuthenticationToken);
string title = string.Format("Welcome {0}!", meResult.Result["first_name"]);
var message = string.Format("You are now logged in - {0}", loginResult.UserId);
var dialog = new MessageDialog(message, title);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
else
{
session = null;
var dialog = new MessageDialog("You must log in.", "Login Required");
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
}
}
다른 포럼에서 Chris라는 누군가가 답변을주었습니다. 관리 대시 보드로 이동하여 모바일 앱을 선택하고 시작하기에서 "기존 Windows Store 앱 연결"링크를 클릭하십시오. 그런 다음 주어진 코드를 App 클래스에 복사하십시오. 내가 누락 된 것은 무엇인가. – user1490586