Xamarin Forms with Xamarin Player OAuth2 NInterpre

2019-08-20 10:13发布

问题:

I'm currently on developing some little application for iOS and Android. Therefore I need an OAuth2 authentication.

How I proceeded (from here)

  1. Create a new Xamarin.Forms project from the templates with the default Item and About page
  2. Add Dependency for Xamarin.Auth
  3. Use the button on the about page to trigger a function with the following:

            var authenticator = new OAuth2Authenticator(
                                                    "CLIENTID"
                                                    ,
                                                    "SCOPE",
                                                    new
                                                        Uri("AUTH_URL"),
                                                    new Uri("REDIRECT_URL)
                                                    null,
                                                    true);
    
  4. Add the iOS initializer in the AppDelegate.cs global::Xamarin.Auth.Presenters.XamarinIOS.AuthenticationConfiguration.Init();
  5. Add the URL Types in Info.plist

I'm using the Xamarin Live Player to deploy this on my iPhone 7. When I'm triggering the button, I get the following error message:
Uncaught Exception: Bad convert with overflow instruction 'IL_0001: conv.ovf.i.un' (NInterpretExcetion)

Some ideas how to fix this?