Google Plus使用OAuth 2.0滚动问题

时间:2016-01-11 19:18:06

标签: ios xcode swift google-oauth google-plus-signin

我正在寻找初学者的帮助,以便在Xcode 7.2中使用Swift实现Google登录库(我没有使用CocoaPods)。我按照此处列出的步骤操作:https://developers.google.com/identity/sign-in/ios/sdk/以手动安装SDK。我已经添加了此处指定的所有链接框架和libz.1.1.3.tbd文件。从这里开始,我没有在 AppDelegate.swift 文件中输入任何代码。

我已成功使用OAuth 2.0登录 - Google向我发送了一封确认新设备已登录的电子邮件。当我到达'APP_NAME时想要:'应用权限页面时,用户应找到该问题单击“允许”按钮的选项。这里不允许我向下滚动以找到模拟器中的按钮。

我只修改了以下两个文件:

GSignIn-桥接-Header.h

#import <GoogleSignIn/GoogleSignIn.h>

ViewController.swift

import UIKit

class ViewController: UIViewController, GIDSignInDelegate, GIDSignInUIDelegate {

    @IBOutlet weak var signInButton: GIDSignInButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        GIDSignIn.sharedInstance().delegate = self
        GIDSignIn.sharedInstance().uiDelegate = self

        GIDSignIn.sharedInstance().clientID = "(my.correct.clientID)"

        GIDSignIn.sharedInstance().scopes.append("https://www.googleapis.com/auth/plus.login")
        GIDSignIn.sharedInstance().scopes.append("https://www.googleapis.com/auth/plus.me")

        GIDSignIn.sharedInstance().signInSilently()
    }

    func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
        if let err = error {
            print(error)
        }
        else {
            performSegueWithIdentifier("idSegueContent", sender: self)
        }
    }


    func signIn(signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!, withError error: NSError!) {

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

加载模拟器时显示的相关错误是:

  

2016-01-11 18:19:44.045 GSignIn [10378:448732]无法找到支持键盘iPhone-Portrait-PhonePad的5型键盘;使用3561727473_Portrait_iPhone-Complex-Pad_Default

1 个答案:

答案 0 :(得分:0)

这是一个简单的解决方案。我将屏幕旋转到横向并再次返回到纵向,以显示“允许”#39;按钮,但不知道是什么原因引起了这个问题。