ios - How to log out from fbsession? -


h,in app user can login app using facebook.i able login using fbsession not able logout form fbsession.once user login app have manually log out fbsession. not able log out fbseesion. in app when ever click on login button not directing login page directly showing dialog page,where me have show login page every time in app. here code

   - (ibaction)facebooklogin:(id)sender  {        [fbsession openactivesessionwithreadpermissions:@[@"email",@"user_location",@"user_birthday",@"user_hometown"]                                    allowloginui:yes                               completionhandler:^(fbsession *session, fbsessionstate state, nserror *error) {                                    switch (state) {                                       case fbsessionstateopen:                                           [[fbrequest requestforme] startwithcompletionhandler:^(fbrequestconnection *connection, nsdictionary<fbgraphuser> *user, nserror *error) {                                               if (error) {                                                   nslog(@"error:%@",error);                                               }                                               else                                               {                                                   // retrive user's details @ here shown below                                                   nslog(@"user   :%@",user);                                                    nsdictionary *resultdict=[[[nsdictionary alloc]initwithobjectsandkeys:user.first_name,@"firstname",user.last_name,@"lastname",user.last_name,@"lastname",user.birthday,@"birthday",user.username,@"username",[user objectforkey:@"email"],@"email",user.id,@"fbuserid", nil]autorelease];                                                    [[nsuserdefaults standarduserdefaults]setobject:resultdict forkey:@"fbuserdetails"];                                                   nsstring *userid=[nsstring stringwithformat:@"%@@social",user.id];                                                   [self performselector:@selector(checksocialnetworkingregisteredornot:) withobject:userid afterdelay:0.0f];                                               }                                           }];                                           break;                                        default:                                           break;                                   }                               } ];  } 

/////////////////////////manually logout fbsession ///////////

  - (ibaction)logoutmanullayinbackground:(id)sender { [fbsession.activesession closeandcleartokeninformation]; [[fbsession activesession] close]; [[fbsession activesession] closeandcleartokeninformation]; [fbsession setactivesession:nil]; 

}

you logging out (the fact see button "log in" again means you've logged out). however, if you're using sso (via either ios integrated login, or facebook app), when user clicks "log in" again, won't prompted (since user on app or device has authorized app).

to around (since you're making restaurant app), can uninstall facebook app (and remove login ios), or can log in fbsessionloginbehaviorforcingwebview when open session.

see https://developers.facebook.com/docs/reference/ios/current/class/fbsession/#openwithbehavior%3acompletionhandler%3a


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -