我如何在 Xamarin.iOS 中使用 Google 的人 API?

How can I use Google's people API in Xamarin.iOS?

我必须在 Xamarin 中访问 Google 联系人。 ios app 所以,我们在 Google developer portal 中生成了 Google 的人 API 密钥和客户端 ID 但是我不知道如何在Xamarin.ios app中消费API。我们需要使用 API 获取 Google 联系方式。 我们在 Google 文档中获得了一些 .net 代码,但不幸的是,它在 Xamarin.ios 平台上不起作用。 xamarin 平台不支持 DLL。 请帮我解决这个问题。

我已经使用 Xamarin.Auth 库解决了它。

Auth = new OAuth2Authenticator(
             Configuration.ClientId,
             string.Empty,
             "https://www.googleapis.com/auth/contacts",
             new Uri("https://accounts.google.com/o/oauth2/v2/auth"),
             new Uri(Configuration.RedirectUrl),
             new Uri("https://www.googleapis.com/oauth2/v4/token"),
             isUsingNativeUI: true);

            var viewController = Auth.GetUI();
            PresentViewController(viewController, true, null);

            Auth.Completed += Auth_Completed;
            Auth.Error += Auth_Error;



 private void Auth_Error(object sender, AuthenticatorErrorEventArgs e)
        {

        }



 private  void  Auth_Completed(object sender, AuthenticatorCompletedEventArgs e)
        {

            // SFSafariViewController doesn't dismiss itself
            DismissViewController(true, null);

            if (e.IsAuthenticated)
            {
            }
     }

必须在 Appdelegate.cs 中实现 OpentUrl() 直到 iOS 12 及以上 iOS 13 在 SceneDelegate.cs

中实现 OpenUrlContexts() 方法