之后,当回到应用程序代码时,请不要输入此功能:
-(voID)signIn:(GIDSignIn *) signIn dIDSignInForUser:(GIDGoogleUser *) user withError:(NSError *) error
任何人都可以帮助我我不能使用其他功能登录我必须调用[[GIDSignIn sharedistance] signIn]并且此功能检测是否安装了另一个谷歌应用程序并自动打开另一个谷歌应用程序或WebvIEw.
解决方法import UIKitimport GoogleSignInimport Googleclass VIEwController: UIVIEwController,GIDSignInUIDelegate,GIDSignInDelegate {overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() let gIDSingIn = GIDSignIn() GIDSignIn.sharedInstance().uIDelegate = self gIDSingIn.delegate = self GIDSignIn.sharedInstance().delegate = self var configureError:NSError? GGLContext.sharedInstance().configureWithError(&configureError) assert(configureError == nil,"Error configuring Google services: \(configureError)") let button = GIDSignInbutton(frame:CGRectMake(0,30,200)) button.center = self.vIEw.center button.backgroundcolor = UIcolor.bluecolor() self.vIEw.addSubvIEw(button) // Do any additional setup after loading the vIEw,typically from a nib.}overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning() // dispose of any resources that can be recreated.}@IBAction func signInGoogle(sender: AnyObject) { print("pressed")}func signIn(signIn: GIDSignIn!,dIDSignInForUser user: GIDGoogleUser!,withError error: NSError!) { if (error == nil) { // Perform any operations on signed in user here. print(user.userID) // For clIEnt-sIDe use only! print(user.authentication.IDToken) // Safe to send to the server print(user.profile.name) print(user.profile.givenname) print(user.profile.familyname) print(user.profile.email) print(user.authentication.accesstoken) print(user.profile) } else { print("\(error.localizedDescription)") }}func signIn(signIn: GIDSignIn!,dIDdisconnectWithUser user:GIDGoogleUser!,withError error: NSError!) {}
}
//这是使用gmail帐户登录而不是Googleplus.只需在您的控制器中复制和过去.
并在AppDelegate类中添加以下func
func application(application: UIApplication,openURL url: NSURL,sourceApplication: String?,annotation: AnyObject) -> Bool { var options: [String: AnyObject] = [UIApplicationopenURLOptionsSourceApplicationKey: sourceApplication!,UIApplicationopenURLOptionsAnnotationKey: annotation] return GIDSignIn.sharedInstance().handleURL(url,sourceApplication: sourceApplication,annotation: annotation)}总结
以上是内存溢出为你收集整理的ios – 使用GIDSignIn处理使用其他Google应用登录时,不会获取Google用户全部内容,希望文章能够帮你解决ios – 使用GIDSignIn处理使用其他Google应用登录时,不会获取Google用户所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)