ios - Facebook session invalid after closing an app -
i'm working on app uses sso login facebook. i've followed tutorial on developer website ios , have working login , logout system :)
however, every time when startup app, session not valid (anymore) , it's asking me authorize app. possible session keeps valid, after closed app, , how implement that? i've tried following code:
// restore saved facebook credentials (if any) delegate.facebook.accesstoken = [[nsuserdefaults standarduserdefaults] stringforkey:@"fbaccesstoken"]; delegate.facebook.expirationdate = (nsdate *) [[nsuserdefaults standarduserdefaults] objectforkey:@"fbexpirationdate"]; // trigger sso facebook authentication if required if ([delegate.facebook issessionvalid] == no) { [delegate.facebook authorize:nil]; } else { [self fbloginwithusername:username andpassword:password]; }
but still it's asking me authorize. it's annoying users see authorization window every time login. have idea this?
thanks in advance!
ensure nsuserdefaults
string use accesstoken
not nil
, saving correctly.
Comments
Post a Comment