cocoa touch - facebook iphone sdk logout issue! -


ive been searching solution seems simple problem while have had no luck. login code follows.

- (bool)application:(uiapplication *)application handleopenurl:(nsurl *)url {  return [facebook handleopenurl:url];  }   - (void)applicationdidbecomeactive:(uiapplication *)application {     nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults];      nsstring *accesstoken = [prefs stringforkey:@"facebook-accesstoken"];     nsdate *expirationdate = [prefs objectforkey:@"facebook-expirationdate"];     facebook.accesstoken = accesstoken;     facebook.expirationdate = expirationdate;     if ([facebook issessionvalid]) {     nslog(@"valid session"); } else {     nslog(@"not valid");     [facebook authorize:nil delegate:self]; } }  - (void)fbdidlogin {     nslog(@"delegate method");     nsstring *accesstoken = facebook.accesstoken;     nsdate *expirationdate = facebook.expirationdate;     nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults];     [prefs setobject:accesstoken forkey:@"facebook-accesstoken"];     [prefs setobject:expirationdate forkey:@"facebook-expirationdate"];     [prefs synchronize]; } 

i have property of type facebook in rootviewcontroller , button logout. pass facebook instance rootviewcontroller , try log out follows.

-(ibaction) logout {     [facebook logout:self];  }  - (void)fbdidlogout {      nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults];     [prefs setobject:nil forkey:@"facebook-accesstoken"];     [prefs setobject:nil forkey:@"facebook-expirationdate"];     [prefs synchronize]; } 

it kind of works..... eg. when not log out can restart app after closing down (holding icon pressing x) , user logged in without having anything. when log out, next time app started user doesnt chance re-enter login details, instead facebook page saying "you have authorised app use facebook"??

does know if going wrong way annoying me now?

many thanks

jules

the user might not need re-enter credentials again because of single sign-on:

in updated version of sdk, changed authorization mechanism users no longer have re-enter credentials every application on device want authorize.

if user logged facebook application, see "you have authorized app use facebook" page.

the logout method clears application state , makes server request invalidate current access token.

note logging out not revoke application's permissions, clears application's access token. if user has logged out of application returns, he see notification he's logging application, not notification grant permissions.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -