我已经设置了Azure AD B2C,并配置了外部身份提供程序。我试图关注this tutorial并且已经卡在这里MainActivity.cs(我的Xamarin解决方案中的Android项目):
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
LoadApplication(new App());
App.UiParent = new UIParent(Xamarin.Forms.Forms.Context as Activity);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(requestCode, resultCode, data);
}
}
我在App.UiParent上变红了,说" UiParent"不在App上。
我已经添加了Microsoft Authentication Library / Microsoft.Identity.Client的1.1版本,甚至还有dev版本,并得到了相同的结果。
作为奖励,我也获得了Forms.Context已经过时了。
答案 0 :(得分:3)
您缺少Application
子类中的公共变量:
public class App : Application
{
public static IAuthenticate AuthenticationProvider { get; private set; }
public static UIParent UiParent = null;
public App()
{
~~~~
回复:App.cs#L12