首页 > 解决方案 > Xamarin 表单与 Xamarin Player OAuth2 NInterpretException

问题描述

我目前正在为 iOS 和 Android 开发一些小应用程序。因此我需要 OAuth2 身份验证。

我是如何进行的(从这里开始

  1. 从具有默认项目和关于页面的模板创建一个新的 Xamarin.Forms 项目
  2. 添加依赖项Xamarin.Auth
  3. 使用 about 页面上的按钮触发具有以下功能的功能:

            var authenticator = new OAuth2Authenticator(
                                                    "CLIENTID"
                                                    ,
                                                    "SCOPE",
                                                    new
                                                        Uri("AUTH_URL"),
                                                    new Uri("REDIRECT_URL)
                                                    null,
                                                    true);
    
  4. 在 AppDelegate.cs 中添加 iOS 初始化程序global::Xamarin.Auth.Presenters.XamarinIOS.AuthenticationConfiguration.Init();
  5. 添加 URL 类型Info.plist

我正在使用 Xamarin Live Player 在我的 iPhone 7 上部署它。当我触发按钮时,我收到以下错误消息:
Uncaught Exception: Bad convert with overflow instruction 'IL_0001: conv.ovf.i.un' (NInterpretExcetion)

一些想法如何解决这个问题?

标签: xamarinxamarin.formsxamarin.iosxamarin.authxamarin-live-player

解决方案


推荐阅读