ios - finishedWithAuth(auth: GTMOAuth2Authentication!, error: NSError!) Only called once -


i have used following code implementing facebook , google plus login in ios app.facebook working fine. tapping google plus signin button allowed enter details through safari or google+ app. problem first time gets logged in successfully. when tap signout or disconnect buttons on view controller, not logging in again. finishedwithauth delegate not called second time. although again presented view enter details.

please me. have searched on no hope.

import uikit import fbsdkcorekit import fbsdkloginkit   class viewcontroller:   uiviewcontroller,fbsdkloginbuttondelegate,gppsignindelegate {  var signin = gppsignin.sharedinstance() // @iboutlet weak var signinbutton: gppsigninbutton!  override func viewdidload() {     super.viewdidload()       signin.shouldfetchgoogleplususer = true     signin.shouldfetchgoogleuseremail = true     signin.shouldfetchgoogleuserid = true      signin.scopes.append(kgtlauthscopepluslogin)     signin.scopes.append("profile")     signin.delegate = self     signin.trysilentauthentication()      if fbsdkaccesstoken.currentaccesstoken() == nil {          print("not logged in")      } else {          print("logged in")      }   }     override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { //        if segue.identifier == "idseguecontent" { //            contentviewcontroller = segue.destinationviewcontroller as! contentviewcontroller //        } }    func finishedwithauth(auth: gtmoauth2authentication!, error: nserror!) {     print("\(error), \(auth)")      if ((error) != nil) {          print(error.localizeddescription)      } else {           print(signin.useremail)         print(signin.userid)         self.performseguewithidentifier("loggedin", sender: self)      }  }  func loginbutton(fblogin: fbsdkloginbutton!, didcompletewithresult result: fbsdkloginmanagerloginresult!, error: nserror!) {      if error == nil {         print("logged")         self.performseguewithidentifier("loggedin", sender: self)      }else {          print(error.localizeddescription)     } }  func loginbuttondidlogout(loginbutton: fbsdkloginbutton!) {     print("logged out") }  // action facebook login button @ibaction func fbloginaction(sender: anyobject) {      let fbloginmanager : fbsdkloginmanager = fbsdkloginmanager()     fbloginmanager.loginwithreadpermissions(["email"], fromviewcontroller: self) { (result, error) -> void in         let fbloginresult : fbsdkloginmanagerloginresult = result         if(fbloginresult.grantedpermissions.contains("email"))         {             self.getfbuserdata()  //                fbloginmanager.logout()         }     }  }  // function data facebook login func getfbuserdata(){     if((fbsdkaccesstoken.currentaccesstoken()) != nil){         fbsdkgraphrequest(graphpath: "me", parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email"]).startwithcompletionhandler({ (connection, result, error) -> void in             if (error == nil){                 let imageurldic: nsdictionary = (result.objectforkey("picture"))?.objectforkey("data") as! nsdictionary                 let imageurl = imageurldic.objectforkey("url") as! string                 singletonclass.sharedinstance.name = result.objectforkey("first_name") as! string                 singletonclass.sharedinstance.userimage = imageurl //                    print(result)                 self.performseguewithidentifier("loggedin", sender: self)             }         })     } }   @ibaction func googlepluslogin(sender: anyobject) {      signin.authenticate();  }  override func didreceivememorywarning() {     super.didreceivememorywarning() //         dispose of resources can recreated. }  } 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -