ios - AccessToken still exists even after removing an app from Facebook settings -


i want custom login button have blue color when:

  1. the user has authorized app , accesstoken still exists

i want custom login button have gray color when:

  1. an access token has expired , want user log in , new one

well, tried doing if/else condition can see in order test did following:

  1. went facebook settings (web)
  2. clicked on 'apps'
  3. searched app , removed it

now, custom login button have graycolor because removing authorized app facebook settings have deleted accesstoken however, that's not case.

i need custom button appear active(blue color) , inactive(gray color) depending on whether or not user has authorized app

thanks in advance

my code:

import uikit import fbsdkcorekit import fbsdkloginkit  class viewcontroller: uiviewcontroller {      let loginbutton: uibutton = uibutton(type: .custom)      override func viewdidload() {         super.viewdidload()         // additional setup after loading view, typically nib.          if fbsdkaccesstoken.currentaccesstoken() != nil {              loginbutton.backgroundcolor = uicolor.bluecolor()         } else {             loginbutton.backgroundcolor = uicolor.graycolor()         }          loginbutton.frame = cgrectmake(0, 0, 180, 40)         loginbutton.settitle("my login button", forstate: .normal)         // handle clicks on button         loginbutton.addtarget(self, action: "loginwithfacebook", forcontrolevents: .touchupinside)         // add button view         self.view!.addsubview(loginbutton)      }      func loginwithfacebook() {         let login: fbsdkloginmanager = fbsdkloginmanager()          login.loginwithpublishpermissions(["publish_actions"], fromviewcontroller: self) { (result: fbsdkloginmanagerloginresult!, error) -> void in             if (error != nil) {                 nslog("process error")             }             else if result.iscancelled {                 nslog("cancelled")             }             else {                 nslog("logged in")                 self.loginbutton.backgroundcolor = uicolor.bluecolor()             }         }     }    } 

why must delete application on facebook?

when run simulator can choose top bar mac: simulator > reset content settings... > click reset

this should erase memory simulator. can test happens when facebook session , access token doesn't exist.


Comments