首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我如何在Xamarin.iOS中使用谷歌的people API?

我如何在Xamarin.iOS中使用谷歌的people API?
EN

Stack Overflow用户
提问于 2020-02-11 13:13:42
回答 1查看 107关注 0票数 0

我必须访问谷歌联系人在我们的Xamarin。因此,我们已经在门户中生成了谷歌的people API密钥和客户端id,但我不知道如何在Xamarin.ios应用程序中使用API。我们需要使用API获取谷歌联系方式的详细信息。我们在谷歌文档中找到了一些.net代码,但不幸的是,它并不适用于Xamarin.ios平台。xamarin平台不支持DLL。请帮我解决这个问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-13 09:58:24

我用Xamarin.Auth库解决了这个问题。

代码语言:javascript
运行
复制
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)
            {
            }
     }

必须在OpentUrl 12和iOS 13以上的Appdelegate.cs calss中实现SceneDelegate.cs ()方法

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60169689

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档