2016-10-01 7 views
0

私はGoogleのサインインボタンを作成する方法を学んだだけです。これまで、私のアプリはアカウントを通してログインすることができますが、ログイン後に同じページ(ログインページ)にリダイレクトされます。私はすべてを探知したが、解決策を見つけることができない。 Googleのボタンからサインインした後、別のView Controllerに移動するにはどうすればよいですか?Googleアカウントからログインしたときに他のView Controllerに移動するにはどうすればよいですか? (ios 10)可能であれば

+0

あなたが行きたい別のViewControllerを作る:「SecondViewControllerは、」私はに行きたいビューコントローラです。今度は、両方のView Controllerの間にセグを作り、識別子を与えます。 Google Signinからログインに成功したら、performSegueWithIdentifier( "segueの新しい識別子名")を呼び出します。 – Tuhin

+0

私はこれを行いました: "SecondViewController"は行きたいビューコントローラです: –

答えて

0

私はこれをしなかった:

func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 
    if segue.identifier == "idSegueContent" { 
     secondViewController = segue.destinationViewController as! SecondViewController //Error is here 
    } 
} 



public func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { 
    if (error) != nil { 
     print(error) 
    } 
    else { 
     performSegue(withIdentifier: "idSegueContent", sender: self) 
    } 

} 


func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) { 
    if let err = error { 
     print(error) 
    } 

    SecondViewController.dismissViewControllerAnimated(true, completion: nil) 
    //Error is here too 
} 
関連する問題