如何打开“使用您的Google帐户登录"像当前模型一样的页面当我按“使用Google登录"时查看? [英] How to open "Sign-in with your Google account" page like present model View when I press "Sign in with Google"?

查看:172
本文介绍了如何打开“使用您的Google帐户登录"像当前模型一样的页面当我按“使用Google登录"时查看?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我当前的应用中,我正在使用使用Google登录".我一直想以当前模型ViewController的类型打开使用您的Google帐户登录"页面,即使我安装了诸如"Google+"之类的Google应用.

In my current app, I am using "Sign-in with Google". I always want to open that "Sign-in with your Google account" page in type present model ViewController even if I installed google apps like "Google+ ".

但是,现在我的应用程序中正在发生的事情是,如果我已经登录到已安装的Google+应用程序,它将打开该应用程序,而不是使用Google登录"页面.这意味着它来自我的应用程序并正在打开Goog​​le+应用程序.我不要那个.

But now what's happening in my app is if I already sign into Google+ app, which is already installed, it is opening that app instead of "Sign-in with Google" page. This means that it's coming from out of my app and opening the Google+ app. I don't want that.

这是我的代码:

GIDSignIn *signIn = [GIDSignIn sharedInstance];
signIn.clientID = kClientId;
signIn.allowsSignInWithBrowser = YES;
signIn.scopes = @[@"https://www.googleapis.com/auth/plus.login",@"https://www.googleapis.com/auth/plus.me",@"https://www.googleapis.com/auth/userinfo.email"];
signIn.delegate = self;
[signIn signIn];

我的应用程序目标是每次我单击使用Google登录"按钮时都需要打开使用Google登录"页面,而不是Google应用程序.

My app goal is every time I need to open "Sign-in with Google" page rather than Google apps when I click on "Sign in with Google" button.

推荐答案

在我的项目中,有google登录,并且我使用了最新的GIDSignInButton进行登录.我遵循了将Google登录集成到您的iOS应用中的所有步骤.并检查是否成功登录.问题是我必须使用Google的GIDSignInButton登录,这不适合我的应用程序的UI.

In my project, there are google sign in and I have used latest GIDSignInButton to login. I follow all steps from Integrating Google Sign-In into your iOS app. And checked it is successful login. The problem in it is I have to use Google's GIDSignInButton to login which is not fit in my app's UI.

@property (retain, nonatomic) IBOutlet GIDSignInButton *googleSigninbtn;

因此,我已经按下了自己的按钮,并在情节提要中隐藏了GIDSignInButton.我已经制作了GIDSignInButton的IBOutlet.现在,单击我自己的按钮后,我便使用此插座来调用其委托方法.

So I have taken my own button, and hide GIDSignInButton from my storyboard. I have made IBOutlet of GIDSignInButton already. Now on click of my own button I have used this outlet to call its delegate methods.

- (IBAction)buttonClick:(id)sender
{
    [self.googleSigninbtn sendActionsForControlEvents:UIControlEventTouchUpInside];
}

由于此按钮是隐藏的,但它位于情节提要中,因此它可以工作,我可以从我的应用中使用google登录.可以.

As this button is hidden but it is in storyboard, so it works and I can login with google from my app. It works.

这篇关于如何打开“使用您的Google帐户登录"像当前模型一样的页面当我按“使用Google登录"时查看?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆