我正在寻找一些初学者帮助,以在 Xcode 7.2 中使用 Swift 实现 Google Sign In 库(我没有使用 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-Bridging-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] Can't find keyplane that supports type 5 for keyboard iPhone-Portrait-PhonePad; using 3561727473_Portrait_iPhone-Complex-Pad_Default
最佳答案
事实证明这是一个简单的修复。我将屏幕旋转为横向,然后再次旋转为纵向以显示“允许”按钮,但不知道最初是什么导致了此问题。
关于ios - Google Plus 使用 OAuth 2.0 登录滚动问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34729325/