Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 谷歌加直接到某处登录时_Ios_Xcode_Swift_Google App Engine_Login - Fatal编程技术网

Ios 谷歌加直接到某处登录时

Ios 谷歌加直接到某处登录时,ios,xcode,swift,google-app-engine,login,Ios,Xcode,Swift,Google App Engine,Login,我有个麻烦,我做了这样的界面 当我使用谷歌登录时,它工作正常,并接受了许可,但出现了错误,它将其重定向到我的旧应用程序。它将转到第二视图(nutrisi,但是旧的,而不是新的) 如您所见(新的有按钮,旧的没有..) . 到现在为止,我仍然很困惑,在登录后,我应该在哪里以及编辑什么代码来重定向 这是我的登录代码 //Google Plus(Google+,G+) import UIKit import AddressBook import MediaPlayer import Ass

我有个麻烦,我做了这样的界面

当我使用谷歌登录时,它工作正常,并接受了许可,但出现了错误,它将其重定向到我的旧应用程序。它将转到第二视图(nutrisi,但是旧的,而不是新的)

如您所见(新的有按钮,旧的没有..) . 到现在为止,我仍然很困惑,在登录后,我应该在哪里以及编辑什么代码来重定向

这是我的登录代码

    //Google Plus(Google+,G+)

import UIKit

import AddressBook
import MediaPlayer
import AssetsLibrary
import CoreLocation
import CoreMotion


class SignInViewController: UIViewController,GPPSignInDelegate {
    //fungsi login ke google plus dan tombol tombol beserta permintaan / persyaratan yang harus disetujui
    @IBOutlet weak var btnGPlus: GPPSignInButton!
    @IBOutlet weak var label: UILabel!
    @IBOutlet weak var loadingActivityIndicator: UIActivityIndicatorView!
    let clientId = "555994724868-qpbo9ibls9f2i1ftnokcs8cs40b8ejot.apps.googleusercontent.com";
    let clientSecret = "AnYSDvyeLMWWaqFIWWAsO5ij";
    var signIn:GPPSignIn?


    override func viewDidLoad() {
        super.viewDidLoad()
        btnGPlus.hidden = false
        signIn = GPPSignIn.sharedInstance()
        btnGPlus.style = kGPPSignInButtonStyleWide
        btnGPlus.colorScheme = kGPPSignInButtonColorSchemeDark
        signIn?.shouldFetchGooglePlusUser = true
        signIn?.shouldFetchGoogleUserID = true
        signIn?.shouldFetchGoogleUserEmail = true
        signIn?.clientID = clientId
        signIn?.scopes = ["profile"]
        signIn?.delegate = self;
        // Do any additional setup after loading the view, typically from a nib.
        signIn?.trySilentAuthentication()
        //signIn.authenticate()
        loadingActivityIndicator.startAnimating()
        btnGPlus.hidden = true


        if signIn?.trySilentAuthentication() == false {
            loadingActivityIndicator.stopAnimating()
            loadingActivityIndicator.hidden = true
            btnGPlus.hidden = false
        }



    }

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

    func finishedWithAuth(auth: GTMOAuth2Authentication!, error: NSError!) {

        label.text = auth.userEmail
       print("login success \(auth.userEmail)")
        println("\(signIn?.googlePlusUser.displayName)")
       var cc = signIn?.googlePlusUser.name.familyName
       println("\(cc)")
        println(error)
    }

     func logout(){

        GPPSignIn.sharedInstance().signOut()

    }


    func didFinishSelector(){

    }

    func googlePlusContactsCallback(ticket: GTLServiceTicket!, returnObject: AnyObject?, error: NSError!) {
       /*
        if(error != nil){
            print("\(error)")
            return
        }
        let res  = object as GTLSwiftsampleapiPostRes
        print("\(res.message) \(res.identifier) \(res.registeredAt) \(res.email)")*/
    }


    func didDisconnectWithError(error: NSError!) {
        println("connect fail")
    }



}