Google plus direct to somewhere when login

0 views
Skip to first unread message

daniel thang via StackOverflow

unread,
Aug 20, 2015, 1:37:06 AM8/20/15
to google-appengin...@googlegroups.com

i have a trouble, i made interface like this enter image description here

when i login with google, it works well, and accept the permission, but, the error comes, which it redirect to my old application..and it goes to second view ( nutrisi, but the old one, not the new one) enter image description here

as you can see ( the new one have button, and the old one doesn't have..)

by now, i still confuse, where and what code i should edit for redirect after login

this is my code for login

    //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")
    }



}


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/31935731/google-plus-direct-to-somewhere-when-login

daniel thang via StackOverflow

unread,
Aug 20, 2015, 3:42:10 AM8/20/15
to google-appengin...@googlegroups.com

i have a trouble, i made interface like this enter image description here

when i login with google, it works well, and accept the permission, but, the error comes, which it redirect to my old application..and it goes to second view ( nutrisi, but the old one, not the new one) enter image description here

as you can see ( the new one have button, and the old one doesn't have..) . by now, i still confuse, where and what code i should edit for redirect after login

daniel thang via StackOverflow

unread,
Aug 20, 2015, 4:32:09 AM8/20/15
to google-appengin...@googlegroups.com

i have a trouble, i made interface like this enter image description here

when i login with google, it works well, and accept the permission, but, the error comes, which it redirect to my old application.and it goes to second view ( nutrisi, but the old one, not the new one) enter image description here

Reply all
Reply to author
Forward
0 new messages