我正在开发Xamarin表单(Android和iOS)应用程序并在应用程序启动时检查登录状态,并在用户已登录到应用程序时分配适当的值.此过程需要6秒钟才能在我们的应用程序中加载第一页.我已经按照Xamarin Auth存储用户登录时的凭据.请找到以下过程来存储和检索我在应用程序中使用的登录用户的详细信息.
https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/general/store-credentials/
在App.cs文件的OnStart方法中使用的代码片段:
protected async override void OnStart()
{
LoginType login = DependencyService.Get<ILoginCredentialStorage>().LoginExists();
this.MainPage = new NavigationPage(new HomePage(login));
}
Run Code Online (Sandbox Code Playgroud)
你能否就此建议我减少在应用程序中加载第一页的时间?
问候,
维杰
我正在整合Facebook登录Xamarin PCL.我已经按照示例"漫画书" https://github.com/moljac/Xamarin.Auth.Samples.NugetReferences并将登录过程集成到我的应用程序中.
但是,我从Xamarin PCL项目中调用oauth演示者以在iOS上的应用程序中显示Facebook UI时,我得到了以下异常.我提供了下面使用的代码来调用Facebook UI进行登录.
错误:警告:尝试在Xamarin_Forms_Platform_iOS_PlatformRenderer:0x7ffa00576b80上显示UINavigationController:0x7ffa01275a00,其视图不在窗口层次结构中!
码:
var auth = new OAuth2Authenticator(
clientId: FacebookClientId,
scope: "email",
authorizeUrl: new Uri(FacebookAuthorizeUrl),
redirectUrl: new Uri(FacebookRedirectUri));
auth.AllowCancel = true;
auth.Completed += async (s, es) =>
{
if (es.IsAuthenticated)
{
var request = new OAuth2Request(
"GET",
new Uri("https://graph.facebook.com/me?fields=email,name,picture,cover,birthday"),
null,
es.Account);
var fbResponse = await request.GetResponseAsync();
if (fbResponse != null)
{
var fbUser = JsonValue.Parse(fbResponse.GetResponseText()); // Getting the error for System.Json double exception issue as well for OAuth v1.5.0.0 only in iOS. …Run Code Online (Sandbox Code Playgroud) warnings oauth uinavigationcontroller xamarin.ios xamarin.forms