मैं कैसे हर बार जब मैं अपने अनुप्रयोग शुरू Facebook-iOS-Sdk
के सक्रिय सत्र को बंद करना या तो ऐप्लिकेशन की हत्या के बाद यह मेरे पिछले लॉगिन सत्र विवरण देता है। जब मैं फेसबुक बटन मैं सब कुछ [appDelegate.session closeAndClearTokenInformation];
[FBSession.activeSession close];
[FBSession.activeSession closeAndClearTokenInformation]
..लेकिन सक्रिय सत्र अभी भी नहीं किया गया close..how मैं क्लिक पर पिछला सत्र डेटा बंद कर सकता का इस्तेमाल किया है पर क्लिक करें।फेसबुक-ios-SDK में बंद Facebook सत्र
मैं स्पष्ट करने के लिए नीचे दिए गए कोड का उपयोग लेकिन जब भी मैं फेसबुक बटन पर क्लिक करें नई session..it शुरू करने के लिए मुझे पिछले प्रमाणिकताएं देता है।
- (IBAction)buttonClickHandler:(id)sender {
appDelegate = [[UIApplication sharedApplication]delegate];
// this button's job is to flip-flop the session from open to closed
if (appDelegate.session.isOpen) {
[appDelegate.session closeAndClearTokenInformation];
[FBSession.activeSession close];
[FBSession.activeSession closeAndClearTokenInformation];
FBSession.activeSession=nil;
} else {
if (appDelegate.session.state != FBSessionStateCreated) {
// Create a new, logged out session.
appDelegate.session = [[FBSession alloc] init];
}
// if the session isn't open, let's open it now and present the login UX to the user
[FBSession.activeSession closeAndClearTokenInformation];
FBSession.activeSession=nil;
[FBSession.activeSession openWithBehavior:FBSessionLoginBehaviorForcingWebView
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
// and here we make sure to update our UX according to the new session state
NSLog(@" state=%d",state);
[FBRequestConnection
startForMeWithCompletionHandler:^(FBRequestConnection *connection,
id<FBGraphUser> user,
NSError *error) {
userInfo = @"";
// Example: typed access (name)
// - no special permissions required
userInfo = user.username;
NSLog(@"string %@", userInfo);
[self checkfacebook];
}];
}]; }
}
और में viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
if (!appDelegate.session.isOpen) {
// create a fresh session object
appDelegate.session = [[FBSession alloc] init];
if (appDelegate.session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[FBSession.activeSession close];
FBSession.activeSession=nil;
}
}
NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray* facebookCookies = [cookies cookiesForURL:[NSURL URLWithString:@"http://login.facebook.com"]];
for (NSHTTPCookie* cookie in facebookCookies) {
[cookies deleteCookie:cookie];
}
}
या धन्यवाद आदमी हो! मैंने सब कुछ करने की कोशिश की है लेकिन यह अजीब चीज बार-बार हो रही है :(... – Christien
यह वास्तव में एफबी एपीआई के साथ अजीब है। मुझे एक ही "समस्या" है। बीटीडब्ल्यू, जब आप फेसबुक ऐप से लॉगआउट करते हैं (वास्तविक एफबी एप्लीकेशन ऑन आपका डिवाइस), तो आप वास्तव में लॉग आउट हो गए हैं। अगर आप केवल अपने ऐप में लॉग आउट कर रहे हैं (एफबी एक नहीं) तो आप एसएसओ के साथ लॉग इन करेंगे जिसका उपयोग आप अपने एफबी ऐप में कर रहे हैं ... – Yanchi
बढ़िया! धन्यवाद! ऊपर पूरी तरह से मेरे लिए मेरे लिए भी बहुत धन्यवाद Mr.NitinGohel – Anthony